~aleteoryx/muditaos

c68624ee3730ccbfb715ec1975fdd599b6ed0cce — Bartosz 2 years ago 3e762ab
[MOS-000] Update commit checks

Increased max line length to 100 chars, allowed
auto revert commits to pass CI checks
2 files changed, 4 insertions(+), 4 deletions(-)

M doc/development_workflow.md
M tools/check_commit_messages.py
M doc/development_workflow.md => doc/development_workflow.md +1 -1
@@ 22,7 22,7 @@ Your commit's subject line should be a single sentence describing what you are c
- It must start with a verb. This sentence will be a part of the project changelog, so please ensure it will be clear to the non-technical readers. 
- If you are adding a new feature start with "Add"; start with "Fix" if you are fixing one.
- Don't use proper names such as names of classes or functions. 
- Try to be as concise as possible in the limit of 72 characters (including the Jira ticket number - 11 characters). 
- Try to be as concise as possible in the limit of 100 characters (including the Jira ticket number - 11 characters). 
- Don't end the subject line with a period. 

Then, in the commit message, you must include a short description of what the commit is changing in the project. You should be clear about

M tools/check_commit_messages.py => tools/check_commit_messages.py +3 -3
@@ 1,6 1,6 @@
#!/usr/bin/env python3
'''
Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
'''



@@ 35,7 35,7 @@ def validate_commit(commit):
    errors.append(f'[{commit.hexsha}] commit message should be composed of at least 3 lines: a subject, an empty line and a body')
    return errors

  line_length_limit = 72
  line_length_limit = 100
  if any(len(line) > line_length_limit for line in lines):
    errors.append(f'[{commit.hexsha}] maximum allowed line length is {line_length_limit}')



@@ 43,7 43,7 @@ def validate_commit(commit):
  empty_line = lines[1]
  body = ''.join(lines[2:]).strip()

  subject_format = r'^(\[(EGD|BH|CP|MOS)-\d+\])+ [A-Z].+[^.]$'
  subject_format = r'(^Revert ")|(^\[(EGD|BH|CP|MOS)-\d+\])+ [A-Z].+[^.]$'
  if not re.match(subject_format, subject):
    errors.append(f'[{commit.hexsha}] invalid subject "{subject}", should match format "{subject_format}"')