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

IgnoreResultAction.py: Can use multiline_comment_delimiter as a fallback when comment_delimiter doesn't exist for a language #3441

Closed
hemangsk opened this issue Dec 30, 2016 · 10 comments
Assignees

Comments

@hemangsk
Copy link
Member

Initial discussion
Presently IgnoreResultAction.py uses comment_delimiter attribute to add ignore comments.
Some bears such as CSSLintBear have multiline_comment_delimiter attribute and not a comment_delimiter and therefore this causes failure to add ignore comment in css files.

Steps for reproduction:

  1. Create file style.css
.low{
font-family:Roboto;
color:white;
}

  1. Execute coala --bears CSSLintBear --files style.css
style.css
|   1| .low•{
|    | [NORMAL] CSSLintBear:
|    | Rule doesn't have all its properties in alphabetical order. (order-alphabetical)
|    | *0: Do nothing
|    |  1: Open file(s)
|    |  2: Add ignore comment
|    | Enter number (Ctrl-D to exit): 2
|    | Please enter a value for the parameter 'language' (No description given.): css
[ERROR][14:26:06] Failed to execute the action IgnoreResultAction with error: 'comment_delimiter'.
|    | *0: Do nothing
|    |  1: Open file(s)
|    |  2: Add ignore comment
|    | Enter number (Ctrl-D to exit): 2
|    | Please enter a value for the parameter 'language' (No description given.): css
[ERROR][14:26:13] Failed to execute the action IgnoreResultAction with error: 'comment_delimiter'.
|    | *0: Do nothing
|    |  1: Open file(s)
|    |  2: Add ignore comment
|    | Enter number (Ctrl-D to exit): 2
|    | Please enter a value for the parameter 'language' (No description given.): scss
[ERROR][14:26:19] Failed to execute the action IgnoreResultAction with error: .

It is asking for the parameter 'language' from the user and then if there is no language found with name css, it returns

Failed to execute the action IgnoreResultAction with error: 'comment_delimiter'.

Possible Solution
We can add an option in IgnoreResultAction,

 if language has attribute comment delimiter then
    use comment_delimiter to add ignore comment
 elif language.hasattr(multiline_comment_delimiter) and not language.hasattr(comment_delimiter):
   use multilime_comment_delimiter to add ignore comment
else
  print ("We don't have a comment_delimiter for this language, What would you like to wrap the ignore comment in ?")
   take comment delimiter as an input from user
@nemani
Copy link
Member

nemani commented Dec 30, 2016

Can I try this?

@nemani
Copy link
Member

nemani commented Dec 30, 2016

Unless @hemangsk wants to do it...

@Makman2
Copy link
Member

Makman2 commented Dec 31, 2016

here you go :)

@nemani
Copy link
Member

nemani commented Jan 5, 2017

Sorry I just saw this now 🙈

@hemangsk
Copy link
Member Author

hemangsk commented Jan 5, 2017

Hey @nemaniarjun please feel free to ping me if there's any hindrance in reproducing this issue

@nemani
Copy link
Member

nemani commented Jan 5, 2017

So I have successfully added the ignore comment using the multiline comment delimiter.
But the result is not ignored.
So should I create another issue for that? or continue in this one?

@nemani
Copy link
Member

nemani commented Jan 5, 2017

Ignore the above comment :P Found the mistake.

nemani added a commit to nemani/coala that referenced this issue Jan 6, 2017
Adds support for using multiline comment delimiters, if the
language does not have singleline delimiters.
If no delimiters are found, emits a warning.

Closes #coala#3441
@nemani
Copy link
Member

nemani commented Jan 6, 2017

Error in rultor? This did not get closed? @sils

@sils
Copy link
Member

sils commented Jan 6, 2017

you had a # before the URL, typo

@sils sils closed this as completed Jan 6, 2017
@nemani
Copy link
Member

nemani commented Jan 6, 2017

Okay will keep in mind 👍

CosminIcatoiu pushed a commit to CosminIcatoiu/coala-1 that referenced this issue Jan 12, 2017
Adds support for using multiline comment delimiters, if the
language does not have singleline delimiters.
If no delimiters are found, emits a warning.

Closes #coala#3441
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants