-
Notifications
You must be signed in to change notification settings - Fork 581
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
WIP: CPDBear: Use Redundancy aspects #1391
base: master
Are you sure you want to change the base?
Conversation
Thanks for your contribution! Reviewing pull requests take really a lot of time and we're all volunteers. Please make sure you go through the following check list and complete them all before pinging someone for a review.
As you learn things over your Pull Request please help others on the chat and on PRs to get their stuff right as well! |
bears/general/CPDBear.py
Outdated
@@ -127,4 +126,5 @@ def run(self, language: str, minimum_tokens: int=20, | |||
'that you have more code than you need. Consider' | |||
' refactor your code to remove one of the' | |||
' occurrences. For more information go here:' | |||
'http://tinyurl.com/coala-clone')) | |||
'http://tinyurl.com/coala-clone'), | |||
aspect=Redundancy.clone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line contains following spacing inconsistencies:
- Tabs used instead of spaces.
SpaceConsistencyBear, severity NORMAL, section python
.
The issue can be fixed by applying the following patch:
--- a/bears/general/CPDBear.py
+++ b/bears/general/CPDBear.py
@@ -127,4 +127,4 @@
' refactor your code to remove one of the'
' occurrences. For more information go here:'
'http://tinyurl.com/coala-clone'),
- aspect=Redundancy.clone)
+ aspect=Redundancy.clone)
bears/general/CPDBear.py
Outdated
@@ -91,7 +89,8 @@ def run(self, language: str, minimum_tokens: int=20, | |||
files = ','.join(self.file_dict.keys()) | |||
executable = which('pmd') or which('run.sh') | |||
arguments = ('bash', executable, 'cpd', '--skip-lexical-errors', | |||
'--minimum-tokens', str(minimum_tokens), | |||
'--minimum-tokens', str( | |||
Redundancy.clone.min_clone_tokens.default), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line contains following spacing inconsistencies:
- Tabs used instead of spaces.
SpaceConsistencyBear, severity NORMAL, section python
.
The issue can be fixed by applying the following patch:
--- a/bears/general/CPDBear.py
+++ b/bears/general/CPDBear.py
@@ -90,7 +90,7 @@
executable = which('pmd') or which('run.sh')
arguments = ('bash', executable, 'cpd', '--skip-lexical-errors',
'--minimum-tokens', str(
- Redundancy.clone.min_clone_tokens.default),
+ Redundancy.clone.min_clone_tokens.default),
'--language', self.lowered_lang_dict[language],
'--files', files,
'--format', 'xml')
bears/general/CPDBear.py
Outdated
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, | ||
ignore_identifiers: bool=True, ignore_literals: bool=False, | ||
ignore_usings: bool=False,skip_duplicate_files: bool=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line contains following spacing inconsistencies:
- Tabs used instead of spaces.
SpaceConsistencyBear, severity NORMAL, section python
.
The issue can be fixed by applying the following patch:
--- a/bears/general/CPDBear.py
+++ b/bears/general/CPDBear.py
@@ -50,7 +50,7 @@
def run(self, language: str,ignore_annotations: bool=False,
ignore_identifiers: bool=True, ignore_literals: bool=False,
- ignore_usings: bool=False,skip_duplicate_files: bool=True):
+ ignore_usings: bool=False,skip_duplicate_files: bool=True):
"""
Checks for similar code that looks as it could be replaced to reduce
redundancy.
bears/general/CPDBear.py
Outdated
ignore_literals: bool=False, ignore_usings: bool=False, | ||
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, | ||
ignore_identifiers: bool=True, ignore_literals: bool=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line contains following spacing inconsistencies:
- Tabs used instead of spaces.
SpaceConsistencyBear, severity NORMAL, section python
.
The issue can be fixed by applying the following patch:
--- a/bears/general/CPDBear.py
+++ b/bears/general/CPDBear.py
@@ -49,7 +49,7 @@
return True
def run(self, language: str,ignore_annotations: bool=False,
- ignore_identifiers: bool=True, ignore_literals: bool=False,
+ ignore_identifiers: bool=True, ignore_literals: bool=False,
ignore_usings: bool=False,skip_duplicate_files: bool=True):
"""
Checks for similar code that looks as it could be replaced to reduce
bears/general/CPDBear.py
Outdated
ignore_annotations: bool=False, ignore_identifiers: bool=True, | ||
ignore_literals: bool=False, ignore_usings: bool=False, | ||
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line contains following spacing inconsistencies:
- Trailing whitespaces.
SpaceConsistencyBear, severity NORMAL, section python
.
The issue can be fixed by applying the following patch:
--- a/bears/general/CPDBear.py
+++ b/bears/general/CPDBear.py
@@ -48,7 +48,7 @@
else:
return True
- def run(self, language: str,ignore_annotations: bool=False,
+ def run(self, language: str,ignore_annotations: bool=False,
ignore_identifiers: bool=True, ignore_literals: bool=False,
ignore_usings: bool=False,skip_duplicate_files: bool=True):
"""
bears/general/CPDBear.py
Outdated
@@ -127,4 +126,5 @@ def run(self, language: str, minimum_tokens: int=20, | |||
'that you have more code than you need. Consider' | |||
' refactor your code to remove one of the' | |||
' occurrences. For more information go here:' | |||
'http://tinyurl.com/coala-clone')) | |||
'http://tinyurl.com/coala-clone'), | |||
aspect=Redundancy.clone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E131 continuation line unaligned for hanging indent'
PycodestyleBear (E131), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
@@ -127,4 +126,5 @@ def run(self, language: str, minimum_tokens: int=20, | |||
'that you have more code than you need. Consider' | |||
' refactor your code to remove one of the' | |||
' occurrences. For more information go here:' | |||
'http://tinyurl.com/coala-clone')) | |||
'http://tinyurl.com/coala-clone'), | |||
aspect=Redundancy.clone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W191 indentation contains tabs'
PycodestyleBear (W191), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
@@ -127,4 +126,5 @@ def run(self, language: str, minimum_tokens: int=20, | |||
'that you have more code than you need. Consider' | |||
' refactor your code to remove one of the' | |||
' occurrences. For more information go here:' | |||
'http://tinyurl.com/coala-clone')) | |||
'http://tinyurl.com/coala-clone'), | |||
aspect=Redundancy.clone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E101 indentation contains mixed spaces and tabs'
PycodestyleBear (E101), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
@@ -91,7 +89,8 @@ def run(self, language: str, minimum_tokens: int=20, | |||
files = ','.join(self.file_dict.keys()) | |||
executable = which('pmd') or which('run.sh') | |||
arguments = ('bash', executable, 'cpd', '--skip-lexical-errors', | |||
'--minimum-tokens', str(minimum_tokens), | |||
'--minimum-tokens', str( | |||
Redundancy.clone.min_clone_tokens.default), | |||
'--language', self.lowered_lang_dict[language], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E101 indentation contains mixed spaces and tabs'
PycodestyleBear (E101), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
@@ -91,7 +89,8 @@ def run(self, language: str, minimum_tokens: int=20, | |||
files = ','.join(self.file_dict.keys()) | |||
executable = which('pmd') or which('run.sh') | |||
arguments = ('bash', executable, 'cpd', '--skip-lexical-errors', | |||
'--minimum-tokens', str(minimum_tokens), | |||
'--minimum-tokens', str( | |||
Redundancy.clone.min_clone_tokens.default), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W191 indentation contains tabs'
PycodestyleBear (W191), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
@@ -91,7 +89,8 @@ def run(self, language: str, minimum_tokens: int=20, | |||
files = ','.join(self.file_dict.keys()) | |||
executable = which('pmd') or which('run.sh') | |||
arguments = ('bash', executable, 'cpd', '--skip-lexical-errors', | |||
'--minimum-tokens', str(minimum_tokens), | |||
'--minimum-tokens', str( | |||
Redundancy.clone.min_clone_tokens.default), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E101 indentation contains mixed spaces and tabs'
PycodestyleBear (E101), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, | ||
ignore_identifiers: bool=True, ignore_literals: bool=False, | ||
ignore_usings: bool=False,skip_duplicate_files: bool=True): | ||
""" | ||
Checks for similar code that looks as it could be replaced to reduce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E101 indentation contains mixed spaces and tabs'
PycodestyleBear (E101), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, | ||
ignore_identifiers: bool=True, ignore_literals: bool=False, | ||
ignore_usings: bool=False,skip_duplicate_files: bool=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E231 missing whitespace after ',''
PycodestyleBear (E231), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, | ||
ignore_identifiers: bool=True, ignore_literals: bool=False, | ||
ignore_usings: bool=False,skip_duplicate_files: bool=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E128 continuation line under-indented for visual indent'
PycodestyleBear (E128), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, | ||
ignore_identifiers: bool=True, ignore_literals: bool=False, | ||
ignore_usings: bool=False,skip_duplicate_files: bool=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W191 indentation contains tabs'
PycodestyleBear (W191), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
ignore_literals: bool=False, ignore_usings: bool=False, | ||
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, | ||
ignore_identifiers: bool=True, ignore_literals: bool=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E128 continuation line under-indented for visual indent'
PycodestyleBear (E128), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
ignore_literals: bool=False, ignore_usings: bool=False, | ||
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, | ||
ignore_identifiers: bool=True, ignore_literals: bool=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W191 indentation contains tabs'
PycodestyleBear (W191), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
ignore_literals: bool=False, ignore_usings: bool=False, | ||
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, | ||
ignore_identifiers: bool=True, ignore_literals: bool=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E101 indentation contains mixed spaces and tabs'
PycodestyleBear (E101), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
ignore_annotations: bool=False, ignore_identifiers: bool=True, | ||
ignore_literals: bool=False, ignore_usings: bool=False, | ||
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W291 trailing whitespace'
PycodestyleBear (W291), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
ignore_annotations: bool=False, ignore_identifiers: bool=True, | ||
ignore_literals: bool=False, ignore_usings: bool=False, | ||
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E231 missing whitespace after ',''
PycodestyleBear (E231), severity NORMAL, section autopep8
.
bears/general/CPDBear.py
Outdated
@@ -127,4 +126,5 @@ def run(self, language: str, minimum_tokens: int=20, | |||
'that you have more code than you need. Consider' | |||
' refactor your code to remove one of the' | |||
' occurrences. For more information go here:' | |||
'http://tinyurl.com/coala-clone')) | |||
'http://tinyurl.com/coala-clone'), | |||
aspect=Redundancy.clone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/bears/general/CPDBear.py
+++ b/bears/general/CPDBear.py
@@ -127,4 +127,4 @@
' refactor your code to remove one of the'
' occurrences. For more information go here:'
'http://tinyurl.com/coala-clone'),
- aspect=Redundancy.clone)
+ aspect=Redundancy.clone)
bears/general/CPDBear.py
Outdated
@@ -91,7 +89,8 @@ def run(self, language: str, minimum_tokens: int=20, | |||
files = ','.join(self.file_dict.keys()) | |||
executable = which('pmd') or which('run.sh') | |||
arguments = ('bash', executable, 'cpd', '--skip-lexical-errors', | |||
'--minimum-tokens', str(minimum_tokens), | |||
'--minimum-tokens', str( | |||
Redundancy.clone.min_clone_tokens.default), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/bears/general/CPDBear.py
+++ b/bears/general/CPDBear.py
@@ -90,7 +90,7 @@
executable = which('pmd') or which('run.sh')
arguments = ('bash', executable, 'cpd', '--skip-lexical-errors',
'--minimum-tokens', str(
- Redundancy.clone.min_clone_tokens.default),
+ Redundancy.clone.min_clone_tokens.default),
'--language', self.lowered_lang_dict[language],
'--files', files,
'--format', 'xml')
bears/general/CPDBear.py
Outdated
ignore_annotations: bool=False, ignore_identifiers: bool=True, | ||
ignore_literals: bool=False, ignore_usings: bool=False, | ||
skip_duplicate_files: bool=True): | ||
def run(self, language: str,ignore_annotations: bool=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/bears/general/CPDBear.py
+++ b/bears/general/CPDBear.py
@@ -48,9 +48,9 @@
else:
return True
- def run(self, language: str,ignore_annotations: bool=False,
- ignore_identifiers: bool=True, ignore_literals: bool=False,
- ignore_usings: bool=False,skip_duplicate_files: bool=True):
+ def run(self, language: str, ignore_annotations: bool=False,
+ ignore_identifiers: bool=True, ignore_literals: bool=False,
+ ignore_usings: bool=False, skip_duplicate_files: bool=True):
"""
Checks for similar code that looks as it could be replaced to reduce
redundancy.
CC @userzimmermann instead of me :P
|
e4c3fb0
to
806744d
Compare
bears/general/CPDBear.py
Outdated
@@ -91,7 +89,8 @@ def run(self, language: str, minimum_tokens: int=20, | |||
files = ','.join(self.file_dict.keys()) | |||
executable = which('pmd') or which('run.sh') | |||
arguments = ('bash', executable, 'cpd', '--skip-lexical-errors', | |||
'--minimum-tokens', str(minimum_tokens), | |||
'--minimum-tokens', str( | |||
Redundancy.Clone.min_clone_tokens.default), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhm coala doesn't populate those yet properly right so we can't use it that way yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those arguments will then also be generated automatically from the aspects definitions...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, i was wondering about that, particularly on how the value of the tastes would be accessed ( modified ) by the user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@userzimmermann does that work yet? @AsnelChristian can we have a test for the setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope it doesn't work yet, i just forgot to remove this
So actually, there is no mechanism, to access the tastes of a given aspects and change their value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should write a decorator for that: something like
@staticmethod
@set_aspects( {'Redundancy.Clone.minimun_tokens':'1}
def create_arguments( file, filename, config_file):
```
Having something like
```
LANGUAGES = {....}
ASPECTS = { #a set of aspectbase element}
```
@AsnelChristian @sils @sims1253 @Mixih Let's get coala/coala#3966 through for making PRs like this one here really work... |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
2 similar comments
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey @AsnelChristian :) You can add those aspects to the bear now... |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
7 similar comments
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AsnelChristian This is now related to https://gitlab.com/coala/GSoC-2017/issues/248
cc @Udayan12167
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
6 similar comments
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have tests for this?
CC @sils,