Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup pre-commit for GEF #984

Merged
merged 11 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
## Contributing to GEF ##
## Contributing to GEF

### License ###
## License

`gef` is placed under [MIT license](https://github.com/hugsy/gef/blob/main/LICENSE) which provides Open-Source access to the code and its use.
`gef` is placed under [MIT license](https://github.com/hugsy/gef/blob/main/LICENSE) which provides
Open-Source access to the code and its use.

By contributing to `gef` code through the _Pull Requests_ mechanism, you accept to release the code written by you under the said license.
By contributing to `gef` code through the _Pull Requests_ mechanism, you accept to release the code
written by you under the said license.

## Submitting a Patch

### Submitting a Patch ###

1. Fork `gef` repository (requires GitHub account). Sending a patch from the
1. Fork `gef` repository (requires GitHub account). Sending a patch from the
`patch` or `git diff --patch` commands is not accepted.
1. Write the changes in your local repo.
* Respect the coding style (same indentation format, explicit names as possible)
* Comment your code
* If you add a new feature/GDB command, also write the adequate
documentation (in [`docs/`](docs/))
1. Submit a pull request, make sure it is made against the `main` branch
1. The contributors will review your patch. If it is approved, the change will
1. All the packages required for testing and documenting are listed in `tests/requirements.txt`
1. Adjust your development environment to GEF's: this is achieved using
[`pre-commit`](https://pre-commit.com/), and getting setup is simply done by
1. Installing `pre-commit` PIP package (part of the `requirements.txt` file)
1. Setup `pre-commit` : `pre-commit install`
1. Write the changes in your local repo making sure to respect the coding style (same indentation
format, explicit names as possible), comment your code sufficiently so it becomes maintainable by
someone other than you. Finally if you add a new feature/GDB command, also write the adequate
documentation (in [`docs/`](docs/))
1. Submit a pull request
1. The contributors will review your patch. If it is approved, the change will
be merged via the GitHub, and you will be seen as contributors. If it needs
additional work, the repo owner will respond with useful comments.
1 change: 0 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# These are supported funding model platforms

github: [hugsy,]

6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ body:
id: md_welcome
attributes:
value: |
Complete this form is for reporting bugs in GEF. Incomplete/invalid report will simply being ignored or closed.
Complete this form is for reporting bugs in GEF. Incomplete/invalid report will simply being ignored or closed.
Also note that this is not the place to ask installation or usage problem. Use the Discord channel for that.
- type: textarea
attributes:
Expand Down Expand Up @@ -38,9 +38,9 @@ body:
multiple: false
options:
- "No"
- "Yes"
- "Yes"
validations:
required: true
required: true
- type: checkboxes
attributes:
label: Architecture impacted
Expand Down
21 changes: 5 additions & 16 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@

## Description/Motivation/Screenshots
## Description

<!-- Describe technically what your patch does. -->
<!-- Why is this change required? What problem does it solve? -->
<!-- Why is this patch will make a better world? -->
<!-- How does this look? Add a screenshot if you can -->

<!-- Why is this change required? What problem does it solve? -->

## Against which architecture was this tested ?

"Tested" indicates that the PR works *and* the unit test (see `docs/testing.md`) run passes without issue.
<!-- Why is this patch will make a better world? -->

* [ ] x86-32
* [ ] x86-64
* [ ] ARM
* [ ] AARCH64
* [ ] MIPS
* [ ] POWERPC
* [ ] SPARC
* [ ] RISC-V
<!-- How does this look? Add a screenshot if you can -->

<!-- Annotate your PR with label proper labels (architecture impacted, type of improvement, etc.)

## Checklist

Expand Down
2 changes: 1 addition & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ closeComment: >
complete description; or create a new issue.
Thank you for your contributions.
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: true
exemptMilestones: true
# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: true
Binary file removed .github/workflows/docs-link-check.yml
Binary file not shown.
5 changes: 0 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,3 @@ jobs:
run: |
make -C tests/binaries -j ${{ env.GEF_CI_NB_CPU }}
python${{ env.PY_VER }} -m pytest --forked -n ${{ env.GEF_CI_NB_CPU }} -v -k "not benchmark" tests/

- name: Run linter
run: |
python${{ env.PY_VER }} -m pylint --rcfile=$(pwd)/.pylintrc gef.py tests/*/*.py

31 changes: 31 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Validation

on:
pull_request:
branches:
- main

jobs:
pre_commit:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]

docs_link_check:
name: Check URLs in docs
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: checkout
uses: actions/checkout@v2
- name: Check links
uses: lycheeverse/[email protected]
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
args: --exclude-mail --accept=401 --no-progress 'docs/**/*.md'
fail: false
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
default_stages: [pre-commit, pre-push]
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pycqa/pylint
rev: v3.0.0a6
hooks:
- id: pylint

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.35.0
hooks:
- id: markdownlint-docker
args:
- --config=docs/.markdownlint.yaml
- --ignore=docs/api/gef.md
- --ignore=docs/obsolete/docs/index.md
- --ignore=docs/index.md
- --ignore=README.md
- "docs/**/*.md"
31 changes: 13 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ development. Application developers will also benefit from it, as GEF lifts a gr
GDB obscurity, avoiding repeating traditional commands, or bringing out the relevant information
from the debugging runtime.

## Instant Setup ##
## Instant Setup

Simply make sure you have [GDB 8.0 or higher](https://www.gnu.org/s/gdb) compiled with Python3.6+
bindings, then:


```bash
# via the install script
## using curl
Expand All @@ -44,18 +43,18 @@ You can immediately see that GEF is correctly installed by launching GDB:

A few of `GEF` features include:

* **One** single GDB script
* Entirely **architecture agnostic**, **NO** dependencies: `GEF` is battery-included and [is
* **One** single GDB script
* Entirely **architecture agnostic**, **NO** dependencies: `GEF` is battery-included and [is
installable instantly](https://hugsy.github.io/gef/#setup)
* **Fast** limiting the number of dependencies and optimizing code to make the commands as fast as
* **Fast** limiting the number of dependencies and optimizing code to make the commands as fast as
possible
* Provides a great variety of commands to drastically change your experience in GDB.
* [**Easily** extensible](https://hugsy.github.io/gef/api/) to create other commands by providing
* Provides a great variety of commands to drastically change your experience in GDB.
* [**Easily** extensible](https://hugsy.github.io/gef/api/) to create other commands by providing
d more comprehensible layout to GDB Python API.
* Full Python3 support ([Python2 support was
* Full Python3 support ([Python2 support was
dropped](https://github.com/hugsy/gef/releases/tag/2020.03) - see
[`gef-legacy`](https://github.com/hugsy/gef-legacy)).
* Built around an architecture abstraction layer, so all commands work in any GDB-supported
* Built around an architecture abstraction layer, so all commands work in any GDB-supported
architecture such as x86-32/64, ARMv5/6/7, AARCH64, SPARC, MIPS, PowerPC, etc.
* Suited for real-life apps debugging, exploit development, just as much as CTF
* And a lot more commands contributed by the community available on
Expand All @@ -64,34 +63,30 @@ d more comprehensible layout to GDB Python API.
Check out the [Screenshot page](docs/screenshots.md) for more or [try it
online](https://demo.gef.blah.cat) (user:`gef`/password:`gef-demo`)


## Documentation ##
## Documentation

Unlike other GDB plugins, GEF has an extensive and up-to-date
[documentation](https://hugsy.github.io/gef/). Users are recommended to refer to it as it may help
them in their attempts to use GEF. In particular, new users should navigate through it (see the
[FAQ](https://hugsy.github.io/gef/faq/) for common installation problems), and the problem persists,
try to reach out for help on the Discord channel or submit an issue.


## Current status ##
## Current status

| Documentation |License | Compatibility | CI Tests (`main`) |
|:---:|:---:|:---|--|
| [![Documentation](https://github.com/hugsy/gef/actions/workflows/generate-docs.yml/badge.svg)](https://github.com/hugsy/gef/actions/workflows/generate-docs.yml) | [![MIT](https://img.shields.io/packagist/l/doctrine/orm.svg?maxAge=2592000?style=plastic)](https://github.com/hugsy/gef/blob/main/LICENSE) | [![Python 3](https://img.shields.io/badge/Python-3-green.svg)](https://github.com/hugsy/gef/) | [![CI Test for GEF](https://github.com/hugsy/gef/actions/workflows/run-tests.yml/badge.svg)](https://github.com/hugsy/gef/actions/workflows/run-tests.yml) |


## Contribute ##
## Contribute

To get involved, refer to the [Contribution
documentation](https://hugsy.github.io/gef/#contribution) and the
[guidelines](https://github.com/hugsy/gef/blob/main/.github/CONTRIBUTING.md) to start.

## Sponsors ##
## Sponsors

Another way to contribute to keeping the project alive is by sponsoring it! Check out [the
sponsoring documentation](https://hugsy.github.io/gef/#sponsors) for details so you can be part of
the list of those [awesome sponsors](https://github.com/sponsors/hugsy).


## Happy Hacking 🍻 ##
## Happy Hacking 🍻
17 changes: 7 additions & 10 deletions docs/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#
# Rules: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
#
# Default state for all rules
default: true

Expand All @@ -10,7 +13,7 @@ MD001: true
# MD002/first-heading-h1/first-header-h1 - First heading should be a top-level heading
MD002:
# Heading level
level: 1
level: 2

# MD003/heading-style/header-style - Heading style
MD003:
Expand Down Expand Up @@ -161,7 +164,7 @@ MD032: true
# MD033/no-inline-html - Inline HTML
MD033:
# Allowed elements
allowed_elements: []
allowed_elements: ["img"]

# MD034/no-bare-urls - Bare URL used
MD034: true
Expand Down Expand Up @@ -195,21 +198,15 @@ MD040:
# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
MD041:
# Heading level
level: 1
level: 2
# RegExp for matching title in front matter
front_matter_title: "^\\s*title\\s*[:=]"

# MD042/no-empty-links - No empty links
MD042: true

# MD043/required-headings/required-headers - Required heading structure
MD043:
# List of headings
headings: []
# List of headings
headers: []
# Match case of headings
match_case: false
MD043: false

# MD044/proper-names - Proper names should have the correct capitalization
MD044:
Expand Down
Loading
Loading