Git Product home page Git Product logo

atom-php-checkstyle's Introduction

PHP Checkstyle

Build Status

This plugin is no longer actively maintained as Atom Linter has replicated all the functionality I was offering

This plugin is for the Atom editor from GitHub, and aims to provide “Checkstyle” integration for PHP.

The plugin supports:

  • PHP_CodeSniffer (phpcs)
  • Linter (php -l)
  • PHP Mess Detector (phpmd)
  • Fix the issues using the PHP Coding Standards Fixer (php-cs-fixer) application

You can configure which commands above you want to execute, be it all of them, or just one of them, such as the linter.

The plugin renders the errors in the following formats, again configurable:

  • List view
  • Gutter view
  • Status bar view

You can customise the colours used in the gutter by providing your own stylesheet, just override the css colours for the 3 CSS classes:

.php-checkstyle-report-phpcs
.php-checkstyle-report-phpmd
.php-checkstyle-report-lint

the defaults colours are:

@background-color-phpcs: #3292B8;
@background-color-phpmd: #A087DE;
@background-color-lint: @background-color-error;

atom-php-checkstyle's People

Contributors

benmatselby avatar ciarand avatar postcasio avatar primitive-type avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

atom-php-checkstyle's Issues

Cannot call method 'removeClassFromAllLines' of undefined

Hi,

Since Atom release 0.117+, when I open preferences I get the following error

 Uncaught TypeError: Cannot call method 'removeClassFromAllLines' of undefined php-checkstyle-gutter-view.coffee:30

Anyone else got this error message?

Getting exception 'UnexpectedValueException' upon running phpcs

Hey there,

I've installed this package and set the right executable paths for phpcs, phpcsfixer, and phpmd. All of these have been installed with Homebrew.

Phpmd works, but when enabling phpcs I get an error every time the package runs. Looking at Atom's console, running the same command in Terminal results in the following UnexpectedValueExceptions:

/usr/local/bin/php -l -d display_errors=On /Path/to/File.php; /usr/local/bin/phpcs --standard=PSR2 --report=checkstyle /Path/to/File.php; /usr/local/bin/phpmd /Path/to/File.php text codesize,cleancode,controversial,naming,unusedcode;  
No syntax errors detected in /Path/to/File.php
PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'DirectoryIterator::__construct(/usr/local/etc/php-code-sniffer/Standards): failed to open dir: No such file or directory' in /usr/local/Cellar/php-code-sniffer/1.5.2/CodeSniffer.php:1961
Stack trace:
#0 /usr/local/Cellar/php-code-sniffer/1.5.2/CodeSniffer.php(1961): DirectoryIterator->__construct('/usr/local/etc/...')
#1 /usr/local/Cellar/php-code-sniffer/1.5.2/CodeSniffer/CLI.php(733): PHP_CodeSniffer::getInstalledStandards()
#2 /usr/local/Cellar/php-code-sniffer/1.5.2/CodeSniffer/CLI.php(538): PHP_CodeSniffer_CLI->validateStandard(Array)
#3 /usr/local/Cellar/php-code-sniffer/1.5.2/scripts/phpcs(37): PHP_CodeSniffer_CLI->process()
#4 {main}
  thrown in /usr/local/Cellar/php-code-sniffer/1.5.2/CodeSniffer.php on line 1961

Fatal error: Uncaught exception 'UnexpectedValueException' with message 'DirectoryIterator::__construct(/usr/local/etc/php-code-sniffer/Standards): failed to open dir: No such file or directory' in /usr/local/Cellar/php-code-sniffer/1.5.2/CodeSniffer.php:1961
Stack trace:
#0 /usr/local/Cellar/php-code-sniffer/1.5.2/CodeSniffer.php(1961): DirectoryIterator->__construct('/usr/local/etc/...')
#1 /usr/local/Cellar/php-code-sniffer/1.5.2/CodeSniffer/CLI.php(733): PHP_CodeSniffer::getInstalledStandards()
#2 /usr/local/Cellar/php-code-sniffer/1.5.2/CodeSniffer/CLI.php(538): PHP_CodeSniffer_CLI->validateStandard(Array)
#3 /usr/local/Cellar/php-code-sniffer/1.5.2/scripts/phpcs(37): PHP_CodeSniffer_CLI->process()
#4 {main}
  thrown in /usr/local/Cellar/php-code-sniffer/1.5.2/CodeSniffer.php on line 1961

Isolating the error to the command /usr/local/bin/phpcs --report=checkstyle --standard=PSR2 /Path/to/File.php I attempted to remove and tweak the parameters, and it seems the error is thrown by the '--standard=PSR2' flag. By removing this in the Terminal it works and returns warnings about my code.

I'm not too familiar with PHPCS, so this might not be an issue related to the package, and if it's not—my apologies. :) A quick pointer in the right direction would be fabulous, though. Thanks!

Atom.Object.defineProperty.get is deprecated.

atom.workspaceView is no longer available.
In most cases you will not need the view. See the Workspace docs for
alternatives: https://atom.io/docs/api/latest/Workspace.
If you do need the view, please use atom.views.getView(atom.workspace),
which returns an HTMLElement.

Atom.Object.defineProperty.get (/opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app/src/atom.js:55:11)
PhpCheckstyleStatusBarView.initialize (/Users/morganestes/.atom/packages/php-checkstyle/lib/php-checkstyle-statusbar-view.coffee:15:22)

WorkspaceView.getActivePaneItem is deprecated.

Use Workspace::getActivePaneItem instead

WorkspaceView.getActivePaneItem (/Applications/Atom.app/Contents/Resources/app/src/workspace-view.js:564:7)
PhpCheckstyleStatusBarView.render (/Users/1ring/.atom/packages/php-checkstyle/lib/php-checkstyle-statusbar-view.coffee:66:37)
HTMLDivElement.<anonymous> (/Users/1ring/.atom/packages/php-checkstyle/lib/php-checkstyle-statusbar-view.coffee:40:24)
HTMLDivElement.jQuery.event.dispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4676:9)
HTMLDivElement.elemData.handle (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4360:46)
Object.trigger (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4594:12)
HTMLDivElement.<anonymous> (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:5119:17)
Function.jQuery.extend.each (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:590:23)
ReactEditorView.each (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:237:17)
ReactEditorView.trigger (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:5118:15)
[object Object].componentDidUpdate (/Applications/Atom.app/Contents/Resources/app/src/editor-component.js:267:33)
CallbackQueue.notifyAll (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/CallbackQueue.js:75:22)
ReactReconcileTransaction.ON_DOM_READY_QUEUEING.close (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactReconcileTransaction.js:88:26)
ReactReconcileTransaction.closeAll (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/Transaction.js:214:42)
ReactReconcileTransaction.perform (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/Transaction.js:155:16)
ReactUpdatesFlushTransaction.Mixin.perform (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/Transaction.js:141:20)
ReactUpdatesFlushTransaction.perform (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactUpdates.js:98:38)
flushBatchedUpdates (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactUpdates.js:176:19)
ReactDefaultBatchingStrategyTransaction.closeAll (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/Transaction.js:214:42)
ReactDefaultBatchingStrategyTransaction.perform (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/Transaction.js:155:16)
Object.batchedUpdates (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactDefaultBatchingStrategy.js:70:19)
Object.enqueueUpdate (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactUpdates.js:209:22)
[object Object].forceUpdate (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1232:18)
<unknown> (/Applications/Atom.app/Contents/Resources/app/src/editor-component.js:313:28)

Whitespace / Coffeescript CS

Hey, this is awesome. I'm pretty new to CS too too, and some of the Atom / coffee standards have been a little strange for me to get used to. I don't want to tread on your toes here - do you have a preferred coding style for contributions?

WorkspaceView.getActivePaneItem is deprecated.

Use Workspace::getActivePaneItem instead

WorkspaceView.getActivePaneItem (/Applications/Atom.app/Contents/Resources/app/src/workspace-view.js:564:7)
PhpCheckstyleStatusBarView.render (/Users/eitrix/.atom/packages/php-checkstyle/lib/php-checkstyle-statusbar-view.coffee:66:37)
HTMLDivElement.<anonymous> (/Users/eitrix/.atom/packages/php-checkstyle/lib/php-checkstyle-statusbar-view.coffee:40:24)
HTMLDivElement.jQuery.event.dispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4676:9)
HTMLDivElement.elemData.handle (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4360:46)
Object.trigger (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4594:12)
HTMLDivElement.<anonymous> (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:5119:17)
Function.jQuery.extend.each (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:590:23)
ReactEditorView.each (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:237:17)
ReactEditorView.trigger (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:5118:15)
[object Object].componentDidUpdate (/Applications/Atom.app/Contents/Resources/app/src/editor-component.js:267:33)
CallbackQueue.notifyAll (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/CallbackQueue.js:75:22)
ReactReconcileTransaction.ON_DOM_READY_QUEUEING.close (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactReconcileTransaction.js:88:26)
ReactReconcileTransaction.closeAll (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/Transaction.js:214:42)
ReactReconcileTransaction.perform (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/Transaction.js:155:16)
ReactUpdatesFlushTransaction.Mixin.perform (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/Transaction.js:141:20)
ReactUpdatesFlushTransaction.perform (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactUpdates.js:98:38)
flushBatchedUpdates (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactUpdates.js:176:19)
ReactDefaultBatchingStrategyTransaction.closeAll (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/Transaction.js:214:42)
ReactDefaultBatchingStrategyTransaction.perform (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/Transaction.js:155:16)
Object.batchedUpdates (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactDefaultBatchingStrategy.js:70:19)
Object.batchedUpdates (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactUpdates.js:113:20)
ReactEventListener.dispatchEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactEventListener.js:186:20)

JavaScript errors when opening settings

When I go to Atom's settings page the web inspector pops up with the following errors:

Uncaught TypeError: Cannot read property 'removeClassFromAllLines' of undefined /Users/alexbilbie/.atom/packages/php-checkstyle/lib/php-checkstyle-gutter-view.coffee:33
2Uncaught TypeError: Cannot read property 'id' of undefined /Users/alexbilbie/.atom/packages/php-checkstyle/lib/php-checkstyle-gutter-view.coffee:26
Uncaught TypeError: Cannot read property 'removeClassFromAllLines' of undefined /Users/alexbilbie/.atom/packages/php-checkstyle/lib/php-checkstyle-gutter-view.coffee:33

Failed to load the php-checkstyle package on Atom start-up

I just downloaded Atom for the first time and started it up today, and got this error straight away before even seeing the welcome screen.

  1. Download a fresh install of Atom for Mac.
  2. You might need to remove any user preferences before you run it for the first time, since this is the first time I have installed it.
  3. Start the app.

This error report came from the second time I started Atom because I thought maybe just restarting might help. The only configuration changes I made were to the projectHome directory, as you'll see in the config read-out.

Atom Version: 1.6.2
System: Mac OS X 10.11.4
Thrown From: php-checkstyle package, v0.12.0

Stack Trace

Failed to load the php-checkstyle package

At Cannot read property 'prototype' of undefined

TypeError: Cannot read property 'prototype' of undefined
    at __extends (<anonymous>:1:1)
    at <anonymous>:8:3
    at Object.<anonymous> (<anonymous>:8:3)
    at Object.<anonymous> (<anonymous>:1:1)
    at Module._compile (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .coffee] (/Applications/Atom.app/Contents/Resources/app.asar/src/compile-cache.js:208:21)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:50:27)
    at Object.<anonymous> (<anonymous>:2:25)
    at Object.<anonymous> (<anonymous>:1:1)
    at Module._compile (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .coffee] (/Applications/Atom.app/Contents/Resources/app.asar/src/compile-cache.js:208:21)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:50:27)
    at Object.<anonymous> (<anonymous>:2:21)
    at Object.<anonymous> (<anonymous>:1:1)
    at Module._compile (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .coffee] (/Applications/Atom.app/Contents/Resources/app.asar/src/compile-cache.js:208:21)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:50:27)
    at Package.module.exports.Package.requireMainModule (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:720:27)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:116:28
    at Package.module.exports.Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:92:15)
    at Package.module.exports.Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:106:12)

Commands

Config

{
  "core": {
    "ignoredNames": [
      ".git",
      ".svn",
      ".DS_Store"
    ],
    "projectHome": "/Users/jwatson/Source",
    "themes": [
      "atom-dark-ui",
      "atom-dark-syntax"
    ]
  }
}

Installed Packages

# User
minimap, v4.21.0
php-checkstyle, v0.12.0
vim-mode, v0.65.0

# Dev
No dev packages

Able to disable the popup

It would be nice if we could choose to disable the popup that appears with the issues in? I'd prefer just having the gutter and status bar markers

Poor colour contrast makes it really hard to read the list view.

Not sure if this is an issue with this package, or atom in general, but with the default Atom Dark theme, the poor colour contrast in the list view makes it really hard to read anything.

screenshot from 2014-06-16 21 17 03

Happy to change custom atom stylesheet, if that's the best solution... I don't have a clue how though, but happy to follow instructions :-)

Atom.Object.defineProperty.get is deprecated.

atom.workspaceView is no longer available.
In most cases you will not need the view. See the Workspace docs for
alternatives: https://atom.io/docs/api/latest/Workspace.
If you do need the view, please use atom.views.getView(atom.workspace),
which returns an HTMLElement.

Atom.Object.defineProperty.get (/Applications/Atom.app/Contents/Resources/app/src/atom.js:55:11)
PhpCheckstyleStatusBarView.initialize (/Users/giuseppelobrutto/.atom/packages/php-checkstyle/lib/php-checkstyle-statusbar-view.coffee:15:22)

Uncaught TypeError: Cannot read property 'length' of undefined

I'm running in this bug when I click the listview.

screenshot 2014-04-04 00 20 28

screenshot 2014-04-04 00 20 46

The command on dev-tools window is:

[php-checkstyle]/usr/local/bin/php -l -d display_errors=On /Users/yriveiro/Development/test.php; /usr/local/bin/phpcs --standard=PSR2 --report=checkstyle /Users/yriveiro/Development/test.php; /usr/bin/phpmd /Users/yriveiro/DevelopmentUsers/yriveiro/Development/test.php text codesize,cleancode,controversial,naming,unusedcode;  commands.coffee:20

I think that the first error is not on any row of the file and It's like a advice or something. When I click in the listview is not possible goto the row X and throws the error.

Package.getStylesheetsPath is deprecated.

Store package style sheets in the styles/ directory instead of stylesheets/ in the php-checkstyle package

Package.getStylesheetsPath (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:460:9)
Package.getStylesheetPaths (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:471:32)
Package.loadStylesheets (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:453:38)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:185:19)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:165:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:179:12)

Multiple Status Bars

It seems that every time I deactivate and reactivate the plugin, it adds an additional status bar at the bottom of the editor.

Uncaught NotFoundError

I'm having this message each time this package runs and found an error:

Uncaught NotFoundError: An attempt was made to reference a Node in a context where it does not exist.

A dev-tools window opens and when I try to close it, it's open again in loop mode.

If I disable the package this behavior doesn't happen,

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.