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 Meta #2896

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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},
Copy link
Member

Choose a reason for hiding this comment

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

this isnt a template if it has literal values in it.

);
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},
);
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: {}
26 changes: 17 additions & 9 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 (
Copy link
Member

Choose a reason for hiding this comment

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

Is this dependency manager available in the coala package_manager?

Copy link
Author

Choose a reason for hiding this comment

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

No it is not available, Thank you for pointing me in the right direction ... I will create PerlRequirement file.

Copy link
Member

@sangamcse sangamcse Apr 14, 2019

Choose a reason for hiding this comment

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

BTW the issue is not about creating a dependency. This issue is to create just Perl meta.
NM.

Copy link
Author

Choose a reason for hiding this comment

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

I don't think there is a need to add PerlRequirement as CpanRequirement is already present..

Copy link
Member

Choose a reason for hiding this comment

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

If CpanRequirement is the requirement here, then work with that. Adding PerlRequirement here without having it in package_manager will break it

Copy link
Member

Choose a reason for hiding this comment

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

Will you be fixing this @Ishaan29 ?

PerlRequirement)
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY


Expand All @@ -24,15 +28,19 @@ 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'),
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',
),
]
)
}
AUTHORS = {'The coala developers'}
AUTHORS_EMAILS = {'[email protected]'}
Expand Down