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

Commit message bug fix : dot after the issue #187 #256

Closed
wants to merge 2 commits into from

Conversation

keshavgbpecdelhi
Copy link

Issue : #187

Changes

#Please explain changes made in your PR#

The problems like this https://github.com/openwisp/openwisp-controller/runs/2529479318 when placing a fullstop at the end of long description, is fixed.

Checklist

  • I have read the contributing guidelines.
  • I have manually tested the proposed changes.
  • I have written new test cases to avoid regressions. (if necessary)
  • I have updated the documentation. (e.g. README.rst)
  • I have added [change!] to commit title to indicate a backward incompatible change. (if required)
  • I have checked the links added / modified in the documentation.

#Closes #(issue-number)#

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a failing test, then the patch should fix the failing test.

@keshavgbpecdelhi
Copy link
Author

Didn't get it 🤔

@codesankalp
Copy link
Member

@keshavgbpecdelhi You need to write a test that fails before your change and after introducing your change it passes.

See this:

@capture_stderr()
def test_qa_call_check_commit_message_failure(self):
options = [
['commitcheck'],
['commitcheck', '--quiet', '--message', 'Hello World'],
['commitcheck', '--quiet', '--message', '[qa] hello World'],
['commitcheck', '--quiet', '--message', '[qa] Hello World.'],

Add a test that fails when there is a dot in the commit message as mentioned in the issue and will pass if your changes are introduced in the code.

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keshavgbpecdelhi You need to write a test that fails before your change and after introducing your change it passes.

See this:

@capture_stderr()
def test_qa_call_check_commit_message_failure(self):
options = [
['commitcheck'],
['commitcheck', '--quiet', '--message', 'Hello World'],
['commitcheck', '--quiet', '--message', '[qa] hello World'],
['commitcheck', '--quiet', '--message', '[qa] Hello World.'],

Add a test that fails when there is a dot in the commit message as mentioned in the issue and will pass if your changes are introduced in the code.

Exactly, thank you @codesankalp.

@devkapilbansal
Copy link
Member

It may be possible that the long description contains more lines after the issue closing line,

Like:-

[qa] Commit message bug fix #187

Closes #187.

Signed off by:- Kapil Bansal

If yes, in that case your proposed solution will not work @keshavgbpecdelhi

@keshavgbpecdelhi
Copy link
Author

Sir if we remove the "." from long_desc like this :
long_desc = checked.split('.').join("");
And test cases making like this :
openwisp-utils/tests/test_project/tests/test_qa.py
@capture_stderr() def test_qa_call_check_commit_message_failure(self): options = [ ['commitcheck'], ['commitcheck', '--quiet', '--message', 'Hello World'], ['commitcheck', '--quiet', '--message', '[qa] hello World'], ['commitcheck', '--quiet', '--message', '[qa] Hello World.'],
How do we check it and write like this. Here it's inside options and --quiet, --messages with [qa] not able to understand it. And how we arrange it.

@keshavgbpecdelhi
Copy link
Author

I found one more way :
long_desc = long_desc.replace(/\./g,' ');
Is it the correct solution? How to check it and make test cases mentioned like this?

@keshavgbpecdelhi You need to write a test that fails before your change and after introducing your change it passes.

See this:

@capture_stderr()
def test_qa_call_check_commit_message_failure(self):
options = [
['commitcheck'],
['commitcheck', '--quiet', '--message', 'Hello World'],
['commitcheck', '--quiet', '--message', '[qa] hello World'],
['commitcheck', '--quiet', '--message', '[qa] Hello World.'],

Add a test that fails when there is a dot in the commit message as mentioned in the issue and will pass if your changes are introduced in the code.

@devkapilbansal
Copy link
Member

We don't want to remove dot. Just wanna ignore it. So, we can just replace . with space too. Else you can modify the regex a bit. That would be much cleaner solution

@pandafy
Copy link
Member

pandafy commented Oct 8, 2021

Just my two cents:

The problem is not the dot here. It is the regex which look for " #". The question asked should be, why is it considering "." to be a part of the check.

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failing test still missing.
See the first point of this section in the django docs:
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/submitting-patches/#bugs

A regression test is a requirement for bug fixes in many modern open source projects.

@devkapilbansal
Copy link
Member

Superseeded by #267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants