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

Add instructions to set up pre-commit #593

Merged
merged 2 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
30 changes: 8 additions & 22 deletions devtools/README.rst
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
##########################################
Scripts for Linting with Pylint and Flake8
##########################################
###############################
Scripts for Linting with Flake8
###############################

Usage
======

To use, run either the run_pylint_linting.sh or run_flake8_linting.sh scripts
It is recommended to run ``pre-commit install`` in a terminal under the main ``DESC`` directory.

These will generate a pylint.output file, or flake8_errors.ouput and flake8_summary.output files.
Then anytime you commit with ``git commit`` the linting suite will run automatically.

Currently, black is still ran through GitHub actions.
To manually generate a linting report you need to execute the shell script ``run_flake8_linting.sh`` by typing ``sh run_flake8_linting.sh`` in a terminal from the ``devtools`` directory.

Most formatting-level errors are being suppressed; errors that touch the code logic are primarily the ones being raised.
This will generate the ``flake8_errors.output`` and ``flake8_summary.output`` files.

Currently, black is still ran through GitHub actions.

Most formatting-level errors are being suppressed; errors that touch the code logic are primarily the ones being raised.


Outputs
Expand All @@ -25,15 +26,6 @@ Flake8
flake8_errors.output will contain a line-by-line listing of errors
flake8_summary.output will total these up into categories in a quick summary

Pylint
------
Pylint.output currently will contain, in the following order :
1. a series of line-specific reports, then
2. show duplicated code blocks
3. a dependency tree
4. an error summary



Configuration
=============
Expand All @@ -43,9 +35,3 @@ Flake8
Currently, error messages about whitespace and indenting that black does not care about have been suppressed.
These will be fixed in a future cleanup branch.
More errors can be added to the [flake8] section of settings.cfg after "ignore=", separated by commas.

Pylint:
-------
Currently several classes of error are being suppressed, mostly to do with preferring encapsulating behavior into simpler classes and modules.
To disable certain classes of error message, go to the [MESSAGES] section of pylinrc, and add the error to "disable=" separated by commas.
Additionally, several very minor errors are being suppressed to be fixed in a future cleanup branch.
1 change: 1 addition & 0 deletions devtools/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ flake8 >= 5.0.0, <=6.0.0
flake8-docstrings >= 1.0.0, <=2.0.0
flake8-eradicate >= 1.0.0, <=2.0.0
flake8-isort >=5.0.0, <= 6.0.0
pre-commit

# testing and benchmarking
markupsafe == 2.0.1
Expand Down
1 change: 1 addition & 0 deletions devtools/dev-requirements_conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies:
- flake8-docstrings >= 1.0.0, <=2.0.0
- flake8-eradicate >= 1.0.0, <=2.0.0
- flake8-isort >=5.0.0, <= 6.0.0
- pre-commit

# testing and benchmarking
- markupsafe = 2.0.1
Expand Down
Loading