dffml icon indicating copy to clipboard operation
dffml copied to clipboard

service : dev : Enhance commit message linting

Open programmer290399 opened this issue 4 years ago • 4 comments

  • See https://github.com/intel/dffml/pull/1076#issuecomment-864556863 for full details
  • Related Issue #1040
  • [x] 1. All commits starting with test shouldn't contain any test_ in the rest of the parts
    • Implement a new mutation which is only triggered when the commit starts with test
  • [x] 2. Substitutions are required for certain cases , where a word should translate to a path
    • Add a substitution step which would replace such cases with their respective actual paths.
  • [ ] 3. Checking for function/class names in files/folders
    • Add a mutation which checks for a valid , file/directory path by recursively removing segments from the end of it until it finds a valid file/directory path , and then it searches for the removed segments in those files.
    • for ex: In util: net: cached_download(): Changed logging , the mutation should remove the cached_download() part and check for util/net as a path with extensions mutation, and by this it will resolve to dffml/util/net.py, and then we've to search in that file for the removed part , i.e. cached_download() in this file, similarly if it resolved to a directory then we'd need to search all the files in that directory.
    • This might sound complicated but it can be implemented easily as a body_mutation , we'd need this category for other things as well curretly we have only prefix_mutations and suffix_mutations only , this body mutation should only be applied if all the removed parts are found in their respective file/directory paths.
  • [ ] 4. Capitalization should be done for certain parts of the path
    • Implement a body mutation to handle capitalisation of last and second last parts of the path.
  • [ ] 5. Special keywords should be ignored
    • A simple body mutation to filter these words can be implemented.
  • [ ] 6. Investigate why this is failing and fix it, related to 1. above
  • [ ] 7. Add support for "Merge branch x into y" type of commits.
  • [ ] 8. Add support for Reverted " < some valid commit > " type of commits.
  • [ ] 9. Add rule that all that checks whether the first letter of every section of the commit is capitalised
  • [ ] 10. Fix the bug introduced while implementing 1. above

programmer290399 avatar Jun 22 '21 17:06 programmer290399

There is some problem with commits related to tests, most probably related to point 1 above: Some failing examples:

tests: Renamed `accuracy` to `score`


model: vowpalWabbit: tests: Renamed `accuracy` to `score`


model: scikit: tests: Renamed `accuracy` to `score`


model: pytorch: tests: Renamed `accuracy` to `score`

programmer290399 avatar Sep 19 '21 11:09 programmer290399

We might want to go with https://commitizen-tools.github.io/commitizen/, let's discuss this today

johnandersen777 avatar Sep 21 '21 14:09 johnandersen777

Looks great !! I guess it might be the best way to do it as we're sort of re-inventing the wheel here, I will look into it and come up with a plan to port our lint commit CMD to use this. Thanks for sharing 🙂 .

programmer290399 avatar Sep 22 '21 02:09 programmer290399

We might want to go with https://commitizen-tools.github.io/commitizen/, let's discuss this today

We can also look into this one: https://github.com/wagoid/commitlint-github-action

programmer290399 avatar Feb 21 '22 03:02 programmer290399