Conversation
Reworked the run_pylint script to analyse files concurrently, one single-threaded pylint process per file, with a configurable worker count that defaults to the host processor count. Added a --precommit mode that layers a reduced check set over the base configuration and wired it into a new pre-commit hook driven by staged filenames, and broadened the default scope to all tracked Python files in the repository. Corrected the Python sources newly brought into lint scope by that broadened coverage, fixing genuine defects, naming and style violations, and reindenting to the project's two-space standard. Session prompts: 1. > Custom Bash script "run_pylint" is responsible for executing > pylint across the code base. A set of modifications are to be > implemented. > 1. The script should be capable of operating in a multi-threaded > fashion. Analysis of each individual file can only run > single-threaded, but independent processes can analyse > multiple files in parallel. A command-line option must be > made available to permit manual specification of how many > such processes can run in parallel; in the absence of such an > option, the maximal number of parallel threads should be > determined by the number of processors available on the > executing system. > 2. The script should have a "--diff" operating mode similar to > that introduced to the check_syntax script. When executed in > this mode, only those Python files with git staged changes > are to be processed, and the command return code must > reflect the presence of at least one error in at least one > such file. > 3. The script is to be trialed as a pre-commit hook. It should > be executed in --diff mode, using an alternative > configuration file with a reduced set of tests. Initially > only the detection of TODO flags will be excluded from the > existing checks. > Devise a plan for these changes. Comment on the feasibility of > implementing step 1 while remaining as a Bash script rather > than porting to Python. Examine the set of conditions currently > imposed by the MRtrix3 pylint configuration and propose a set > of checks to be disabled when executing as a pre-commit hook: > this can consider both execution speed (pre-commit hooks > should be fast) and suitability (some violations might be OK to > be present in a specific commit but need to be rectified for CI > before merging a Pull Request). 2. > Apply the requisite corrections to the Python source code files > newly checked by the run_pylint script. Generated-by: Claude Opus 4.8 <noreply@anthropic.com>
|
clang-tidy review says "All clean, LGTM! 👍" |
|
clang-tidy review says "All clean, LGTM! 👍" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
run_pylintwas causing some grief, and I've definitely been frustrated in the past pushing Python code changes only to have thepylintCI test show that the code is completely non-executable. It can take a very long time to run though, hence not always running it through before pushing code. So I thought I'd set Claude at improving its efficiency and integrating it as a pre-commit hook. It can now run only over those files modified by a commit, and multi-thread running across files.Notably, what is run in the pre-commit hook is not the same comprehensive check as that of the CI. I quite often leave TODO markers in one code comment intending to fix something in a subsequent comment, and so precluding the presence of those flags in individual commits would preclude that kind of usage. Some can also take longer to execute, so skipping such checks in the pre-commit hook should be beneficial.
Claude also told me off that
run_pylintwas ignoring some Python source code files in the repo, so I let it run across those and rectify issues.