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

Way to get diff information? #314

Closed
matthiasbeyer opened this issue Aug 1, 2022 · 3 comments
Closed

Way to get diff information? #314

matthiasbeyer opened this issue Aug 1, 2022 · 3 comments
Assignees
Labels
enhancement User-facing feature enhancements
Milestone

Comments

@matthiasbeyer
Copy link
Contributor

Is there a way to get information about the diff of the actual commit the rule is working on?

I want to implement a check that compares the size of the diff to the size of the commit message and if a certain ratio is exceeded, emits an error or warning (e.g.: 1000 LOC change and only 1 line of message might be a no-no for some 😄 )

@jorisroovers
Copy link
Owner

This is something I've wanted to add but haven't gotten to. This should be fairly easy, I'll keep this issue open to get this implemented.

For now, there's a fairly easy workaround using gitlint.git._git, similar to the following example:
#108 (comment)

I'll re-iterate though that this is NOT officially supported, I'm not committing to keep that working in future versions of gitlint.

@jorisroovers jorisroovers added the enhancement User-facing feature enhancements label Aug 2, 2022
@jorisroovers jorisroovers added this to the 0.18.0 milestone Aug 2, 2022
@matthiasbeyer
Copy link
Contributor Author

Awesome, thanks for considering this! 🎉

jorisroovers added a commit that referenced this issue Sep 6, 2022
jorisroovers added a commit that referenced this issue Sep 6, 2022
jorisroovers added a commit that referenced this issue Sep 7, 2022
jorisroovers added a commit that referenced this issue Sep 8, 2022
@jorisroovers jorisroovers self-assigned this Sep 15, 2022
@jorisroovers
Copy link
Owner

Implemented in #334, will go out with the next release (0.18.0)

jorisroovers added a commit that referenced this issue Nov 16, 2022
- Python 3.11 support
- Last release to support Python 3.6
- Behavior Change: In a future release, gitlint will be switching to use
  `re.search` instead of `re.match` semantics for all rules. (#254)
- gitlint no longer uses the `sh` library by default in an attempt to reduce
  external dependencies.
- `--commits` now also accepts a comma-separated list of commit hashes,
  making it possible to lint a list of non-contiguous commits without invoking
  gitlint multiple times (#283)
- Improved handling of branches that have no commits (#188)
- Support for `GITLINT_CONFIG` env variable (#189)
- Added a new `gitlint-ci` pre-commit hook, making it easier to run gitlint
  through pre-commit in CI (#191)
- Contrib Rules:
  - New `contrib-disallow-cleanup-commits` rule (#312)
  - New `contrib-allowed-authors` rule (#358)
- User Defined rules:
  - Gitlint now recognizes `fixup=amend` commits, available as
    `commit.is_fixup_amend_commit=True`
  - Gitlint now parses diff **stat** information, available in
    `commit.changed_files_stats` (#314)
- Bugfixes:
  - Use correct encoding when using `--msg-filename` parameter (#310)
  - Various documentation fixes (#244) (#263) (#266) (#294) (#295) (#347) (#364)
- Under-the-hood:
  - Dependencies updated
  - Moved to blacked for formatting
  - Fixed nasty CI issue (#298)
  - Unit tests fix (#256)
  - Vagrant box removed in favor of github dev containers (#348)
  - Removed a few lingering references to the `master` branch in favor of `main`
  - Moved roadmap and project planning to github projects

Full Release details in CHANGELOG.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement User-facing feature enhancements
Projects
Status: 0.18.0
Development

No branches or pull requests

2 participants