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

WIP: CPDBear: Use Redundancy aspects #1391

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AsnelChristian
Copy link
Member

@AsnelChristian AsnelChristian commented Feb 2, 2017

CC @sils,

@gitmate-bot
Copy link
Collaborator

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!

@@ -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)
Copy link
Collaborator

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)

@@ -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),
Copy link
Collaborator

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')

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):
Copy link
Collaborator

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.

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,
Copy link
Collaborator

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

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,
Copy link
Collaborator

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):
         """

@@ -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)
Copy link
Collaborator

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.

@@ -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)
Copy link
Collaborator

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.

@@ -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)
Copy link
Collaborator

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.

@@ -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],
Copy link
Collaborator

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.

@@ -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),
Copy link
Collaborator

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.

@@ -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),
Copy link
Collaborator

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.

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
Copy link
Collaborator

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.

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):
Copy link
Collaborator

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.

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):
Copy link
Collaborator

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.

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):
Copy link
Collaborator

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.

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,
Copy link
Collaborator

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.

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,
Copy link
Collaborator

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.

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,
Copy link
Collaborator

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.

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,
Copy link
Collaborator

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.

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,
Copy link
Collaborator

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.

@@ -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)
Copy link
Collaborator

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)

@@ -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),
Copy link
Collaborator

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')

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,
Copy link
Collaborator

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.

@sils
Copy link
Member

sils commented Feb 2, 2017 via email

@AsnelChristian AsnelChristian force-pushed the use_aspects branch 2 times, most recently from e4c3fb0 to 806744d Compare February 2, 2017 21:47
@@ -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),
Copy link
Member

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

Copy link
Member

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...

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member Author

@AsnelChristian AsnelChristian Feb 6, 2017

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} 
```

@userzimmermann
Copy link
Member

@AsnelChristian @sils @sims1253 @Mixih Let's get coala/coala#3966 through for making PRs like this one here really work...

@userzimmermann userzimmermann changed the title CPDBear: Use Redundancy aspects WIP: CPDBear: Use Redundancy aspects Mar 21, 2017
@gitmate-bot
Copy link
Collaborator

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
@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@userzimmermann
Copy link
Member

Hey @AsnelChristian :) You can add those aspects to the bear now...

@gitmate-bot
Copy link
Collaborator

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
@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

Copy link
Member

@userzimmermann userzimmermann left a comment

Choose a reason for hiding this comment

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

@gitmate-bot
Copy link
Collaborator

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
@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

Copy link
Member

@jayvdb jayvdb left a 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?

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

Successfully merging this pull request may close these issues.

7 participants