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

generate_bear_requirements.py: Add Perl Metadata #2888

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .ci/generate_bear_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
'ComposerRequirement',
'CabalRequirement',
'RscriptRequirement',
'PerlRequirement',
)

INSTANCE_NAMES = (
Expand All @@ -60,6 +61,7 @@
'composer_requirements',
'cabal_requirements',
'r_script_requirements',
'perl_requirements'
)


Expand Down Expand Up @@ -174,6 +176,8 @@ def get_pip_requirements(requirements):
def get_cabal_requirements(requirements):
return _get_requirements(requirements, '==')

def get_perl_requirements(requirements):
return _get_requirements(requirements, '==')

def _create_sorted_commented_map(input_dict):
return CommentedMap(sorted(input_dict.items(),
Expand Down Expand Up @@ -266,6 +270,8 @@ def sort_requirements(req_dict):
instance_dict['ComposerRequirement'])
requirements['cabal_requirements'] = get_cabal_requirements(
instance_dict['CabalRequirement'])
requirements['perl_requirements'] = get_perl_requirements(
instance_dict['PerlRequirement'])

if args.update or args.check:
input_file_path = os.path.join(PROJECT_DIR, BEAR_REQUIREMENTS_YAML)
Expand Down
6 changes: 6 additions & 0 deletions .moban.dt/Makefile.PL.jj2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Coala::Bears',
VERSION => '0.10',
PREREQ_PM => {Perl::Critic => 1.126},
);
1 change: 1 addition & 0 deletions .moban.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ targets:
- runtime.txt: runtime.txt
- netlify.toml: docs/netlify.toml
- coala-bears.cabal: coala-bears.cabal.jj2
- Makefile.PL: Makefile.PL.jj2
copy:
- .ci/check_moban.sh: ci/check_moban.sh
- .ci/check_setuptools.py: ci/check_setuptools.py
6 changes: 6 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Coala::Bears',
VERSION => '0.10',
PREREQ_PM => {Perl::Critic => 1.126},
);
Copy link
Member

Choose a reason for hiding this comment

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

add blank at the end of code to prevent travis failing

Copy link
Author

Choose a reason for hiding this comment

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

Sure 😄

1 change: 1 addition & 0 deletions bear-requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,4 @@ cabal_requirements:
version: ==5.6.0.0
hlint:
version: ==1.9.27
perl_requirements: {}
24 changes: 16 additions & 8 deletions bears/perl/PerlCriticBear.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.DistributionRequirement import (
DistributionRequirement)
from dependency_management.requirements.AnyOneOfRequirements import (
AnyOneOfRequirements)
from dependency_managment.requirements.PerlRequirement import (
PerlRequirement)
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY


Expand All @@ -24,14 +28,18 @@ class PerlCriticBear:

LANGUAGES = {'Perl'}
REQUIREMENTS = {
DistributionRequirement(
apt_get='libperl-critic-perl',
brew=None,
dnf='perl-Perl-Critic',
portage='dev-perl/Perl-Critic',
xbps=None,
yum='perl-Perl-Critic',
zypper='perl-Perl-Critic',
AnyOneOfRequirements(
[PerlRequirement(package='Critic',version='==1.126'),
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.

Origin: PEP8Bear, Section: all.autopep8.

The issue can be fixed by applying the following patch:

--- a/tmp/tmpeyw4fo2e/bears/perl/PerlCriticBear.py
+++ b/tmp/tmpeyw4fo2e/bears/perl/PerlCriticBear.py
@@ -29,7 +29,7 @@
     LANGUAGES = {'Perl'}
     REQUIREMENTS = {
         AnyOneOfRequirements(
-            [PerlRequirement(package='Critic',version='==1.126'),
+            [PerlRequirement(package='Critic', version='==1.126'),
              DistributionRequirement(
                 apt_get='libperl-critic-perl',
                 brew=None,

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

Origin: PycodestyleBear (E231), Section: all.autopep8.

DistributionRequirement(
apt_get='libperl-critic-perl',
brew=None,
dnf='perl-Perl-Critic',
portage='dev-perl/Perl-Critic',
xbps=None,
yum='perl-Perl-Critic',
zypper='perl-Perl-Critic',
),
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.

Origin: SpaceConsistencyBear, Section: all.python.

The issue can be fixed by applying the following patch:

--- a/tmp/tmpeyw4fo2e/bears/perl/PerlCriticBear.py
+++ b/tmp/tmpeyw4fo2e/bears/perl/PerlCriticBear.py
@@ -38,7 +38,7 @@
                 xbps=None,
                 yum='perl-Perl-Critic',
                 zypper='perl-Perl-Critic',
-                ), 
+                ),
             ],
         ),
     }

Copy link
Member

Choose a reason for hiding this comment

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

I think the best way to prevent any such errors are using vs code editor

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.

Origin: PEP8Bear, Section: all.autopep8.

The issue can be fixed by applying the following patch:

--- a/tmp/tmpeyw4fo2e/bears/perl/PerlCriticBear.py
+++ b/tmp/tmpeyw4fo2e/bears/perl/PerlCriticBear.py
@@ -38,8 +38,8 @@
                 xbps=None,
                 yum='perl-Perl-Critic',
                 zypper='perl-Perl-Critic',
-                ), 
-            ],
+                ),
+             ],
         ),
     }
     AUTHORS = {'The coala developers'}

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

Origin: PycodestyleBear (W291), Section: all.autopep8.

],
Copy link
Collaborator

Choose a reason for hiding this comment

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

E124 closing bracket does not match visual indentation

Origin: PycodestyleBear (E124), Section: all.autopep8.

),
}
AUTHORS = {'The coala developers'}
Expand Down