Giter Site home page Giter Site logo

linter-perl's Introduction

linter-perl package

This linter plugin for Linter provides an interface to perl. It will be used with files that have the "Perl" syntax.

Installation

  • Install Perl 5.
  • apm install linter (optional)
    • If you didn't install linter package, it will be installed on first activation.
  • apm install linter-perl

Settings

You can configure linter-perl by editing ~/.atom/config.cson (choose Open Your Config in Atom menu):

"linter-perl":
  # The absolute path of perl interpreter.
  # If this was given, executeCommandViaShell and autoDetectCarton are ignored.
  "executablePath": null
  # Is the command executed via `$SHELL -l`?
  # This is useful when PATH is setup in .bash_profile, etc.
  # If true, executablePath option is ignored.
  "executeCommandViaShell": false
  # Is carton enabled if there are both "cpanfile.snapshot" and "local/"
  # in the current root directory?
  "autoDetectCarton": true
  # This is passed to the perl interpreter directly.
  "additionalPerlOptions": null
  # Relative include paths from the current root directory.
  "incPathsFromProjectRoot": [".", "lib"]
  # B::Lint options. "-MO=Lint,HERE"
  # ex. "all,no-bare-subs,no-context"
  "lintOptions": "all"

NOTE: "The current root directory" is the root directory in tree-view which contains the file opened in the active text editor. If no root directories contain the file, its parent directory is selected as the current root directory.

plenv Support

There are three ways to use this package with plenv:

  • Open a project by atom . in your shell.
  • Otherwise (e.g. drag & drop),
    • set "/absolute/path/to/.plenv/shims" to perlExecutablePath (this way is not portable)
    • set true to executeCommnadViaShell (perlExecutablePath is ignored)

Perlbrew is not tested, but those methods could be used.

Contributing

If you would like to contribute enhancements or fixes, please do the following:

  1. Fork the plugin repository.
  2. Hack on a separate topic branch created from the latest master.
  3. Commit and push the topic branch.
  4. Make a pull request.
  5. welcome to the club

Please note that modifications should follow these coding guidelines:

  • Indent is 2 spaces.
  • Code should pass coffeelint linter.
  • Vertical whitespace helps readability, don’t be afraid to use it.

Thank you for helping out!

linter-perl's People

Contributors

arcanemagus avatar renovate-bot avatar ryozi-tn avatar s-shin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

linter-perl's Issues

Uncaught TypeError: Cannot read property 'length' of undefined

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.0.2
System: Mac OS X 10.10.4
Thrown From: linter-perl package, v0.6.1

Stack Trace

Uncaught TypeError: Cannot read property 'length' of undefined

At /Users/chris.mayfield/Downloads/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:413

TypeError: Cannot read property 'length' of undefined
  at TextBuffer.module.exports.TextBuffer.lineLengthForRow (/Users/chris.mayfield/Downloads/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:413:29)
  at exit (/Users/chris.mayfield/.atom/packages/linter-perl/lib/linter-perl.coffee:62:50)
  at triggerExitCallback (/Users/chris.mayfield/Downloads/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:213:47)
  at ChildProcess.<anonymous> (/Users/chris.mayfield/Downloads/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:235:18)
  at emitTwo (events.js:87:13)
  at ChildProcess.emit (events.js:169:7)
  at Process.ChildProcess._handle.onexit (child_process.js:1057:12)

Commands

  2x -2:07.0 core:backspace (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
  2x -1:57.7.0 editor:move-to-first-character-of-line (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
     -1:55.9.0 core:move-left (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
     -1:55.7.0 core:move-down (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
     -1:54.1.0 core:save (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
     -1:04.7.0 editor:newline (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
     -1:03.0 core:backspace (atom-text-editor.editor.vim-mode.insert-mode.is-focused.autocomplete-active)
     -1:00.3.0 core:select-all (atom-text-editor.editor.vim-mode.insert-mode.is-focused.autocomplete-active)
     -0:59 core:move-down (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
     -0:57.9.0 core:move-to-top (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
  5x -0:57.4.0 core:move-down (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
     -0:56.4.0 core:save (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
     -0:47.9.0 core:backspace (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
     -0:02.7.0 core:move-up (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
     -0:02.4.0 core:select-down (atom-text-editor.editor.vim-mode.insert-mode.is-focused)
  2x -0:02.1.0 core:backspace (atom-text-editor.editor.vim-mode.insert-mode.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "git-grep",
      "git-grep",
      "git-grep",
      "open-git-modified-files",
      "git-log",
      "git-plus",
      "tree-view-git-status",
      "merge-conflicts",
      "minimap"
    ]
  },
  "linter-perl": {}
}

Installed Packages

# User
atomatigit, v1.5.3
linter, v1.2.4
linter-perl, v0.6.1
vim-mode, v0.55.0

# Dev
No dev packages

Error running B::Lint

Whenever linter-perl runs it throws the following error, which I found in the Atom dev tools console:

[Linter] Error running B::Lint
"You should make sure to install B::Lint.↵From 5.20, B::Lint is removed from core modules."

from
.atom\packages\linter\lib\linter-registry.js:159

Object.activate is deprecated.

AtomLinter v0.X.Y API has been deprecated. Please refer to the Linter docs to update and the latest API: https://github.com/AtomLinter/Linter/wiki/Migrating-to-the-new-API

Object.activate (/Users/shintaro.seki/.atom/packages/linter/lib/main.coffee:57:8)
Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:240:19)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:221:30)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:165:15)
Package.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:213:14)
PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:452:21)

How to use this plugin?

Can someone please point me to documents on how to use this plug in?

Will I see the feedback in the Atom editor when I open any perl file or I need to run a particular command in DOS console? What would be the command? gulp lint?

PS I am using Windows Active State Perl. (This is perl 5, version 20, subversion 2 (v5.20.2) built for MSWin32-x64-multi-thread).

B::Lint not found

You should make sure to install B::Lint. From 5.20, B::Lint is removed from core modules.

I'm running Strawberry Perl 5.20.1 on Windows 10. B::Lint is installed but linter-perl isn't finding it for some reason. This started happening after the latest upgrade to version 0.8.0 I think

cpan> i B::Lint
Fetching with LWP:
http://cpan.strawberryperl.com/authors/id/R/RJ/RJBS/CHECKSUMS
Module id = B::Lint
    CPAN_USERID  RJBS (Ricardo SIGNES <[email protected]>)
    CPAN_VERSION 1.20
    CPAN_FILE    R/RJ/RJBS/B-Lint-1.20.tar.gz
    UPLOAD_DATE  2014-10-26
    MANPAGE      B::Lint - Perl lint
    INST_FILE    C:\Strawberry\perl\site\lib\B\Lint.pm
    INST_VERSION 1.20
cpan>

executeCommnadViaShell doesn't work.

If executeCommnadViaShell is enabled, a lint command is executed like /bin/bash -l -- perl -MO=Lint,all ....

But, on my environment, /bin/bash -l -- COMMAND doesn't work.

ex.

$ /bin/bash -l -- perl -v
/usr/bin/perl: /usr/bin/perl: cannot execute binary file

Environment:

  • OS X 10.10.2
  • Command Line Tools 6.2

bad linting of switch statement

Consider this code (minimal reproducible case):

#!/usr/bin/perl
use strict;
use warnings;
use Switch;
package Something;
my $a = 0;
switch($a) {          #this line is marked as error
  case 0 { print "0\n" }
  case 1 { print "1\n" }
  else { print "2\n" }
}
1;

The linter gives error:

Error	B::Lint	Illegal reference to private name '_S_W_I_T_C_H'	7:1

However running B:Lint explicitly, it says everything is ok (also, code runs fine):

fiisch@seeker:~/git-repo/perl-dt2g (master %)> perl -MO=Lint minimal_case.pl
minimal_case.pl syntax OK

When I comment out the package Something; and 1; - making it ordinary perl script, the linter problem goes away.
This behavior is quite annoying because I cannot simply look at the code and "see no red, syntax is therefore ok". Could you please look into it?

I am using atom 1.14.4 x64 with linter-perl 0.8.1 and linter 2.2.0 packages. OS is openSuSE 42.1.

new LinterPerl is deprecated.

linter-perl.perlExecutablePath is deprecated.
Please use linter-perl.executablePath in your config.

new LinterPerl (/Users/becker/.atom/packages/linter-perl/lib/linter-perl.coffee:49:13)
Object.activate (/Users/becker/.atom/packages/linter-perl/lib/init.coffee:57:32)
Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:191:19)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:164:32)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:94:15)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:157:26)

Package.getActivationCommands is deprecated.

Use activationCommands instead of activationEvents in your package.json
Commands should be grouped by selector as follows:

  "activationCommands": {
    "atom-workspace": ["foo:bar", "foo:baz"],
    "atom-text-editor": ["foo:quux"]
  }
Package.getActivationCommands (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:810:9)
Package.hasActivationCommands (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:735:20)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:189:24)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:167:15)

Missing error line information

Hi

I'm having some issues with this package. I've attached an image to better show my problems.

When the perl code has some errors, it does not display the error line, neither the file. And on the code window, I don't get error suggestions on the fly neither the red bullet on the left side of the line.

I don't know if this features are supposed to work here, but I was expecting the same behavior as shown on the linter package.

Thanks

perl_linter

Object.dirname is deprecated.

linter-perl made deprecated calls. Automatic issue generator from Atom:

Argument to path.dirname must be a string

Object.dirname (/usr/share/atom/resources/app.asar/src/electron-shims.js:9:10)
Object.determineRootDirectory (/home/pablo/.atom/packages/linter-perl/lib/util.coffee:33:19)
LinterPerl.lint (/home/pablo/.atom/packages/linter-perl/lib/linter-perl.coffee:72:28)
a.factory (/home/pablo/.atom/packages/atom-ide-ui/modules/atom-ide-ui/pkg/atom-ide-diagnostics/lib/services/LinterAdapter.js:263:42)
a._callFactory (/home/pablo/.atom/packages/atom-ide-ui/node_modules/rxjs/bundles/Rx.min.js:107:23)
a.tryDefer (/home/pablo/.atom/packages/atom-ide-ui/node_modules/rxjs/bundles/Rx.min.js:106:442)

Move to AtomLinter org?

@s-shin Would you be interested in moving this provider to the AtomLinter organization? That way there can be more people working on this, and users (like me, currently) don't have to worry about the project becoming abandoned since there is an organization behind the package that has multiple people able to help maintain it.

If you are interested, there is some detailed documentation available here, but the gist of it is transfer it to me and I'll put it in the organization and add you as an explicit collaborator 😉.

Uncaught TypeError: this.element.querySelector is not a function

[Enter steps to reproduce:]

  1. Fresh Atom install
  2. Open Atom and click on "Install a Package" from the "Get to know Atom!" pane
  3. Click "Open Installer"
  4. On the installer page, search for "perl"
  5. Click on "Install" next to "linter-perl 0.8.1"
  6. (potentially optional) Click on "Install" next to "perltidy 4.0.0"
  7. Error should appear during dependency installation.

Atom: 1.18.0 x64
Electron: 1.3.15
OS: Mac OS X 10.12.5
Thrown From: linter-perl package 0.8.1

Stack Trace

Uncaught TypeError: this.element.querySelector is not a function

At /Users/[user]/.atom/packages/linter-perl/node_modules/atom-package-deps/lib/view.js:41

TypeError: this.element.querySelector is not a function
    at View.advance (/packages/linter-perl/node_modules/atom-package-deps/lib/view.js:41:36)
    at /packages/linter-perl/node_modules/atom-package-deps/lib/main.js:53:16
    at stdout (/packages/linter-perl/node_modules/atom-package-deps/lib/helpers.js:24:11)
    at Socket.<anonymous> (/private/var/folders/w5/v569rw8d28s5dkmt_mtzt1200000gr/T/AppTranslocation/30EEFD8F-DAF7-4AEE-B6F1-EDB58AE209A6/d/Atom.app/Contents/Resources/app/src/buffered-process.js:212:17)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:543:20)

Commands

  2x -2:25.8.0 editor:outdent-selected-rows (div.package-detail.panels-item)
     -1:20.2.0 core:confirm (input.hidden-input)

Non-Core Packages

linter 2.2.0 
linter-perl 0.8.1 
perltidy 4.0.0 

Error: Missing html/text field on Linter Response

Error: Missing html/text field on Linter Response
    at /Users/fzzr/.atom/packages/linter/lib/validate.coffee:40:19
    at Array.forEach (native)
    at Object.module.exports.Validate.messages (/Users/fzzr/.atom/packages/linter/lib/validate.coffee:27:14)
    at MessageRegistry.set (/Users/fzzr/.atom/packages/linter/lib/message-registry.js:36:16)
    at /Users/fzzr/.atom/packages/linter/lib/linter.coffee:37:17
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom Beta.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom Beta.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at /Users/fzzr/.atom/packages/linter/lib/linter-registry.js:66:26

After clean installation without any changes, happening for any .pm file.

Project.getPath is deprecated.

Use ::getPaths instead

Project.getPath (C:\Users\Gregory\AppData\Local\atom\app-0.190.0\resources\app\src\project.js:585:12)
LinterPerl.setupCommand (C:\Users\Gregory\.atom\packages\linter-perl\lib\linter-perl.coffee:24:32)

B::Lint is deprecated

B::Lint is deprecated as of 5.18 and removed in 5.20. I think it could be built from cpan, but perhaps perl::critic or perl::lint could be used instead?

B::Lint not found

Hi

Atom keeps complaining about missing B::Lint package. It happens from the last linter-perl update to version 0.7.0. My Atom version is 1.2.2

"
B::Lint not found.
You should make sure to install B::Lint.
From 5.20, B::Lint is removed from core modules.
"

However, I already have the last B::Lint module version:

B::Lint is up to date. (1.20)

I'm running ubuntu and my perl version is perl 5, version 20, subversion 2 (v5.20.2) built for x86_64-linux-gnu-thread-multi

Any help will be appreciate

Regards

Multiple Project Support?

Hi @s-shin,

I'm trying to switch from SublimeText to Atom, one of the things that I need is the possibility to add different paths to the linter depending on the project i'm opening is there any possibility to do this?

((enjoy))
cr

executablePath option is ignored

Execute Command Via Shell doesn't work for me for some reason. It looks like a problem with Mac OS X's path_helper command, which I don't really find too helpful, actually.

Anyway, while trying to figure that out, I was digging around in the source for this and I'm not sure the executablePath option is being used at all. When I set that option and turn off exectuteCommandViaShell to my plenv shims, the command it calls is just "perl" as per usual. It looks like buildCommand or enhancePerlCommand probably need to be updated to use this option.

Support v2 Linter API

In the v2.3.0 release of linter support for the v1 API was removed, breaking semver. This means that this provider is no longer supported by the current version of linter.

To get this provider working again it will need to be upgrade to the v2 API, a guide for accomplishing that can be found here: Upgrading to Standard Linter v2.

Until this is fixed in order to use this provider you will need to downgrade to the last version of linter that supports the v1 API, you can do this with apm install [email protected].

executesCommandViaShell option doesn't work

It seems that the executesCommandViaShell option doesn't work.

Environment:

  • OS X 10.9.4
  • Command line tools of XCode 6
    • GNU bash, version 3.2.51(1)-release-(x86_64-apple-darwin13)
  • Atom 0.129.0
  • linter 0.7.0
  • linter-perl 0.2.0

TODO: check the code of executing command in linter.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Detected dependencies

npm
package.json
  • atom-linter 10.0.0
  • atom-package-deps 5.0.0
  • grim 2.0.2
  • lodash 4.17.11

  • Check this box to trigger a request for Renovate to run again on this repository

Uncaught Error: spawn EACCES

[Enter steps to reproduce below:]

  1. Loaded a .pl file via project folder.

Atom Version: 1.2.2
System: Mac OS X 10.11.1
Thrown From: linter-perl package, v0.7.0

Stack Trace

Uncaught Error: spawn EACCES

At /Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:260

Error: spawn EACCES
    at exports._errnoException (util.js:837:11)
    at ChildProcess.spawn (internal/child_process.js:298:11)
    at Object.exports.spawn (child_process.js:351:9)
    at BufferedProcess.module.exports.BufferedProcess.spawn (/Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:188:44)
    at new BufferedProcess (/Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:52:14)
    at /Users/smithpj/.atom/packages/linter-perl/lib/linter-perl.coffee:105:21
    at LinterPerl.module.exports.LinterPerl.checkBLint (/Users/smithpj/.atom/packages/linter-perl/lib/linter-perl.coffee:90:9)
    at /Users/smithpj/.atom/packages/linter-perl/lib/linter-perl.coffee:85:8
    at LinterPerl.module.exports.LinterPerl.lint (/Users/smithpj/.atom/packages/linter-perl/lib/linter-perl.coffee:84:9)
    at promises.push.Promise.then._this.emitter.emit.linter (/Users/smithpj/.atom/packages/linter/lib/linter-registry.js:63:26)

Commands

     -0:06.7.0 core:close (div.release-notes.padded.pane-item.native-key-bindings)

Config

{
  "core": {
    "ignoredNames": [
      "._*",
      ".svn",
      ".DS_Store",
      ".project"
    ],
    "themes": [
      "atom-dark-ui",
      "atom-dark-syntax"
    ],
    "disabledPackages": [
      "minimap"
    ]
  }
}

Installed Packages

# User
Sublime-Style-Column-Selection, v1.3.0
autocomplete-php, v0.3.7
codeigniter, v0.2.0
file-icons, v1.6.11
jquery-snippets, v11.0.0
linter, v1.11.2
linter-js-standard, v3.2.1
linter-jsonlint, v1.0.1
linter-perl, v0.7.0
php-cs-fixer, v2.5.1
project-manager, v2.6.5
remote-edit, v1.8.22
symbols-tree-view, v0.10.1
tabs-to-spaces, v1.0.0

# Dev
No dev packages

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.