Coder Social home page Coder Social logo

linter-clang's Introduction

linter-clang

Travis.ci Shield Travis.ci Shield AppVeyor Sheild

This linter plugin for Linter provides an interface to clang. It will be used with files that have the "C++", "C", "Objective-C" and "Objective-C++" syntax.

Plugin installation

Install from the Settings pane of Atom by searching for and installing the linter-clang package.

Or install from your Command Prompt by running:

$ apm install linter-clang

This package will ensure that all dependencies are installed on activation.

Project-specific settings

.clang_complete

If your project has some extra include directories, put them in a file called ".clang_complete" and list them line by line. The linter will open the file and use the specified paths when linting in your project.

-Iinclude
-Ilib/foo/include

Please note the file should contain one command line argument per line. These arguments are passed to clang directly using exec and not via a shell. Therefore any spaces are treated as a part of the command line argument.

This means on the one hand -I include results in clang using include (note the space at the beginning) as include directory. For the same reason -I include -I lib/foo/include causes clang to search for includes in include -I lib/foo/include.

On the other hand if your path contains spaces you must not escape them or put quotes around the path. For example: -Ilib/dir with spaces/include only works without any quotes or escaping.

Clang JSON Compilation Database

The Clang JSON Compilation Database is also a supported format for project specific settings.

linter-clang's People

Contributors

aljen avatar amandacameron avatar arcanemagus avatar asaayers avatar dohzya avatar fbbdev avatar greenkeeper[bot] avatar greenkeeperio-bot avatar hd-deman avatar jmlx42 avatar keplersj avatar kevinsawicki avatar longhairedhacker avatar m-bra avatar maxbrunsfeld avatar quentinperez avatar raphinesse avatar renovate-bot avatar snake231088 avatar wackywendell avatar yihangho avatar

Stargazers

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

linter-clang's Issues

Cannot read property 'Split' of undefined

Just updated to the latest linter-clang and getting below error when opening a .inl file.

[Enter steps to reproduce below:]

  1. ... Start Atom
  2. ... Open file https://github.com/neiled/rogue/blob/master/src/Random.inl

Atom Version: 0.196.0 ⚠️ in 1.0 API Preview Mode ⚠️
System: Mac OS X 10.10.3
Thrown From: linter package, v0.12.1

Stack Trace

Uncaught TypeError: Cannot read property 'split' of undefined

At /Users/Edwards/dev/dotfiles/atom/packages/linter/lib/linter.coffee:81

TypeError: Cannot read property 'split' of undefined
  at LinterClang.Linter.getCmdAndArgs (/Users/Edwards/dev/dotfiles/atom/packages/linter/lib/linter.coffee:81:11)
  at LinterClang.lintFile (/Users/Edwards/dev/dotfiles/atom/packages/linter-clang/lib/linter-clang.coffee:46:24)
  at /Users/Edwards/dev/dotfiles/atom/packages/linter/lib/linter-view.coffee:163:18
  at Array.forEach (native)
  at /Users/Edwards/dev/dotfiles/atom/packages/linter/lib/linter-view.coffee:162:18
  at FSReqWrap.oncomplete (fs.js:77:15)

Commands

Config

{
  "core": {
    "themes": [
      "atom-dark-ui",
      "monokai"
    ],
    "disabledPackages": [
      "atom-ternjs"
    ]
  },
  "linter": {}
}

Installed Packages

# User
autocomplete-clang, v0.6.9
autocomplete-html, v0.6.0
autocomplete-plus, v2.12.1
file-icons, v1.5.5
git-log, v0.3.0
highlight-selected, v0.9.2
linter, v0.12.1
linter-clang, v2.25.1
linter-csslint, v0.0.12
linter-jshint, v0.1.2
linter-tidy, v1.0.0
minimap, v4.8.0
monokai, v0.14.0
react, v0.11.8
vim-mode, v0.46.0

# Dev
No dev packages

Specifying include directories

I've got the problem that the linter does not find some header files, as expected, since the locations of some header files are given to the compiler (e.g. some library header files). I can add some include directories in the config, but those are general. It would be better if there was a way to give the linter a filename where it can look up the include directories for the project.

Uses default c flags when linting Objective-C

Did not feel it on my own, but you can see it in the code:
In the constructor, it only sets isCpp to true if linting a .cpp, else to false.
Now, in the lint method, it checks isCpp and then uses the default cpp flags, however, if !isCpp, it uses the default c flags, even if the the file being linted may be an objective-c file. I don't think that this is wanted (what if the c flags are not compatible, or when you want to specify default flags for obj-c only?)

Package.activateConfig is deprecated.

Use a config schema instead. See the configuration section
of https://atom.io/docs/latest/hacking-atom-package-word-count and
https://atom.io/docs/api/latest/Config for more details

Package.activateConfig (C:\Users\Ming\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:247:11)
Package.activateNow (C:\Users\Ming\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:218:14)
<unknown> (C:\Users\Ming\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:203:30)
Package.measure (C:\Users\Ming\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:147:15)

linter-clang Organization Expansion

It appears that this package could do better if @hd-deman expanded the team to the repo's most frequent contributors. I could be totally out of line here, but I'd rather have a larger team than infrequent pull requests being merged.

Install error

Trying to install linter-clang results in following error:

 $ PYTHON=python2 apm install linter-clang

> [email protected] install /tmp/apm-install-dir-115030-16080-zsuyhb/node_modules/linter-clang/node_modules/clang-flags/node_modules/pathwatcher/node_modules/runas
> node-gyp rebuild

make: Entering directory '/tmp/apm-install-dir-115030-16080-zsuyhb/node_modules/linter-clang/node_modules/clang-flags/node_modules/pathwatcher/node_modules/runas/build'
  CXX(target) Release/obj.target/runas/src/main.o
runas.target.mk:88: recipe for target 'Release/obj.target/runas/src/main.o' failed
make: Leaving directory '/tmp/apm-install-dir-115030-16080-zsuyhb/node_modules/linter-clang/node_modules/clang-flags/node_modules/pathwatcher/node_modules/runas/build'

In file included from ../src/main.cc:1:0:
../../nan/nan.h:623:19: error: ‘NanNew’ declared as an ‘inline’ variable
       v8::String::ExternalAsciiStringResource *resource) {
                   ^
../../nan/nan.h:623:19: warning: ‘always_inline’ attribute ignored [-Wattributes]
../../nan/nan.h:623:19: error: ‘v8::Local<v8::String> NanNew’ redeclared as different kind of symbol
../../nan/nan.h:617:36: note: previous declaration ‘v8::Local<v8::String> NanNew(v8::String::ExternalStringResource*)’
   NAN_INLINE v8::Local<v8::String> NanNew(
                                    ^
../../nan/nan.h:623:7: error: ‘ExternalAsciiStringResource’ is not a member of ‘v8::String’
       v8::String::ExternalAsciiStringResource *resource) {
       ^
../../nan/nan.h:623:48: error: ‘resource’ was not declared in this scope
       v8::String::ExternalAsciiStringResource *resource) {
                                                ^
../../nan/nan.h: In function ‘bool _NanGetExternalParts(v8::Handle<v8::Value>, const char**, size_t*)’:
../../nan/nan.h:1993:12: error: ‘class v8::String’ has no member named ‘IsExternalAscii’
   if (str->IsExternalAscii()) {
            ^
../../nan/nan.h:1994:23: error: ‘ExternalAsciiStringResource’ in ‘class v8::String’ does not name a type
     const v8::String::ExternalAsciiStringResource* ext;
                       ^
../../nan/nan.h:1995:5: error: ‘ext’ was not declared in this scope
     ext = str->GetExternalAsciiStringResource();
     ^
../../nan/nan.h:1995:16: error: ‘class v8::String’ has no member named ‘GetExternalAsciiStringResource’
     ext = str->GetExternalAsciiStringResource();
                ^
make: *** [Release/obj.target/runas/src/main.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/atom/resources/app/apm/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 3.18.4-1-ARCH
gyp ERR! command "node" "/usr/share/atom/resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/apm-install-dir-115030-16080-zsuyhb/node_modules/linter-clang/node_modules/clang-flags/node_modules/pathwatcher/node_modules/runas
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 
npm ERR! Linux 3.18.4-1-ARCH
npm ERR! argv "/usr/share/atom/resources/app/apm/bin/node" "/usr/share/atom/resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/usr/share/atom/resources/app/apm/.apmrc" "--userconfig" "/home/daniel/.atom/.apmrc" "install" "/tmp/d-115030-16080-1ucsvxb/package.tgz" "--target=0.21.0" "--arch=x64"
npm ERR! node v0.10.35
npm ERR! npm  v2.3.0
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the runas package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls runas
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /tmp/apm-install-dir-115030-16080-zsuyhb/npm-debug.log

I do not know if this is usefull but I get an nearly identical error with autocomplete-clang

Uncaught TypeError: Arguments to path.resolve must be strings

Trying to type anything in C/C++ gives a big red error box.

Atom Version: 0.175.0
System: Mac OS X 10.10.2
Thrown From: linter-clang package, v2.17.0

Stack Trace

Uncaught TypeError: Arguments to path.resolve must be strings

At path.js:333

TypeError: Arguments to path.resolve must be strings
  at Object.exports.resolve (path.js:333:15)
  at LinterClang.lintFile (/Users/Abdiel/.atom/packages/linter-clang/lib/linter-clang.coffee:73:21)
  at /Users/Abdiel/.atom/packages/linter/lib/linter-view.coffee:139:18
  at Array.forEach (native)
  at /Users/Abdiel/.atom/packages/linter/lib/linter-view.coffee:138:18
  at Object.oncomplete (fs.js:93:15)

Commands

     -4:25.6 grammar-selector:show (atom-text-editor.editor.is-focused)
     -4:08.2 deprecation-cop:view (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-atom-dark-syntax.theme-atom-dark-ui)
  3x -3:57.8 grammar-selector:show (atom-text-editor.editor.is-focused)
  6x -3:18.5 core:backspace (atom-text-editor.editor.is-focused)
     -3:15.5 autocomplete:toggle (atom-text-editor.editor.is-focused)
  3x -3:01.6 grammar-selector:show (atom-text-editor.editor.is-focused)
     -2:24.8 core:backspace (atom-text-editor.editor.is-focused)
  2x -0:40.4 grammar-selector:show (atom-text-editor.editor.is-focused)
     -0:05.2 core:backspace (atom-text-editor.editor.is-focused)
     -0:00.0 deprecation-cop:view (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-atom-dark-syntax.theme-atom-dark-ui)

Config

{
  "core": {
    "themes": [
      "atom-dark-ui",
      "atom-dark-syntax"
    ]
  }
}

Installed Packages

# User
linter, v0.10.0
linter-clang, v2.17.0
linter-csslint, v0.0.11
linter-htmlhint, v0.0.8
linter-jshint, v0.1.0
linter-php, v0.0.11
minimap, v3.5.6

# Dev
No dev packages

/cc @atom/core

Package.activateConfig is deprecated.

Use a config schema instead. See the configuration section
of https://atom.io/docs/latest/hacking-atom-package-word-count and
https://atom.io/docs/api/latest/Config for more details

Package.activateConfig (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:267:11)
Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:238:14)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:223:30)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:167:15)

Execute clang in the same folder as Makefile

We have a lot of packages with the following dir structure:
package_name/Makefile
package_name/include/package/.h
package_name/src/.cpp
package_name/bin/.{cpp,h}
package_name/tests/
And a project/target consists of a set of these packages in a common folder.

Include paths (relative to package_name/) are ./, ./include and ./../usr/include

atom runs clang in the subfolders, i.e. package_name/src/ for a cpp file. So I added a toggle to figure out where the Makefile is located and run clang there (or fall back to the subfolder if no Makefile can be located).

If there is interest in this, I will branch and create a pull request (might actually be a duplicate of Issue #10?)

Uncaught Error: EACCES, permission denied '/.DocumentRevisions-V100'

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 0.175.0
System: Mac OS X 10.10.1
Thrown From: linter-clang package, v2.19.0

Stack Trace

Uncaught Error: EACCES, permission denied '/.DocumentRevisions-V100'

At fs.js:691

Error: EACCES, permission denied '/.DocumentRevisions-V100'
  at Error (native)
  at Object.fs.readdirSync (fs.js:691:18)
  at Object.fs.readdirSync (/Applications/Atom.app/Contents/Resources/atom/common/lib/asar.js:398:26)
  at searchDirectory (/Users/Rohan/.atom/packages/linter-clang/lib/linter-clang.coffee:91:17)
  at searchDirectory (/Users/Rohan/.atom/packages/linter-clang/lib/linter-clang.coffee:95:11)
  at LinterClang.lintFile (/Users/Rohan/.atom/packages/linter-clang/lib/linter-clang.coffee:101:5)
  at /Users/Rohan/.atom/packages/linter/lib/linter-view.coffee:139:18
  at Array.forEach (native)
  at /Users/Rohan/.atom/packages/linter/lib/linter-view.coffee:138:18
  at Object.oncomplete (fs.js:93:15)

Commands

     -0:28.2 editor:newline (input.hidden-input)
     -0:27.7 snippets:next-tab-stop (input.hidden-input)
     -0:27.7 snippets:expand (input.hidden-input)
     -0:27.7 editor:indent (input.hidden-input)
     -0:19.2 snippets:next-tab-stop (input)
     -0:19.2 snippets:expand (input)
     -0:18.2 core:undo (input.hidden-input)
     -0:17.1 core:move-right (input.hidden-input)
     -0:16.1 emmet:insert-formatted-line-break-only (input.hidden-input)
     -0:16.1 editor:newline (input.hidden-input)
  8x -0:15.4 core:backspace (input.hidden-input)
     -0:13.1 emmet:insert-formatted-line-break-only (input.hidden-input)
     -0:13.1 editor:newline (input.hidden-input)
 10x -0:04.7 core:backspace (input.hidden-input)
     -0:01.1 grammar-selector:show (atom-text-editor.editor.editor-colors.vim-mode.insert-mode)
     -0:00.0 core:confirm (input.hidden-input)

Config

{
  "core": {
    "followSymlinks": true,
    "disabledPackages": [
      "atom-lint"
    ],
    "themes": [
      "atom-dark-ui",
      "monokai"
    ],
    "audioBeep": false
  }
}

Installed Packages

# User
atom-jshint, v1.5.0
autoclose-html, v0.14.0
autocomplete-clang, v0.6.1
autocomplete-plus, v1.1.0
autocomplete-plus-async, v0.22.0
autocomplete-snippets, v0.3.2
color-picker, v1.4.4
emmet, v2.3.2
file-icons, v1.4.8
git-tab-status, v1.5.2
highlight-line, v0.9.3
javascript-snippets, v1.0.0
jshint, v1.2.0
linter, v0.10.1
linter-clang, v2.19.0
linter-cpplint, v0.1.3
linter-csslint, v0.0.11
linter-flake8, v1.2.0
linter-htmlhint, v0.0.8
linter-javac, v0.1.3
linter-jshint, v0.1.0
linter-jsxhint, v0.1.0
linter-pylama, v0.0.15
linter-pylint, v0.2.0
meteor-api, v2.9.0
minimap, v3.5.6
monokai, v0.11.0
project-manager, v1.15.0
react, v0.9.3
save-session, v0.11.3
script, v2.16.0
terminal-status, v1.3.5
travis-ci-status, v0.11.1
vim-mode, v0.29.0

# Dev
No dev packages

/cc @atom/core

Silently ignoring unfound header files

Previously, a missing header file would be marked as an error. Now it seems they are not being handled properly. When a header is not in the configured path, linter-clang will not show any issues. However, in dev mode I will see: 'clang: stderr ... fatal error: ... file not found' in the console. In standard mode, linter does not report anything.

Package.activateConfig is deprecated.

Use a config schema instead. See the configuration section
of https://atom.io/docs/latest/hacking-atom-package-word-count and
https://atom.io/docs/api/latest/Config for more details

Package.activateConfig (/usr/share/atom/resources/app.asar/src/package.js:267:11)
Package.activateNow (/usr/share/atom/resources/app.asar/src/package.js:238:14)
<unknown> (/usr/share/atom/resources/app.asar/src/package.js:223:30)
Package.measure (/usr/share/atom/resources/app.asar/src/package.js:167:15)

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)

Make red underline start at the location of the error

For every error detected by the clang linter, it will provide a red underline that covers the entire line which the error occurred on. This makes visually identifying the cause of the error more difficult by providing less immediate information about the problematic piece of code.
Which one of these did I forget to include?

Clang's error output includes not only a line # but a column # indicating the location of the error more precisely. AtomLinter provides functionality allowing you to specify a column for the start of the error, but this functionality is unused in linter-clang. By providing the col regex value in the error match, such as with

':(?<line>\\d+):(?<col>\\d+): .*((?<error>error)|(?<warning>warning)): (?<message>.*)'

we instead get
Ah, that one.
which mitigates the problem somewhat.

I think it is unlikely that it is possible to make the underline only affect the exact area of the line which is problematic, because of the way clang works, but if that's possible, it would be better.

Atom hangs because of this package

When I try to open a C++ file from the tree-view in Atom, the program hangs. No error message is displayed, after some seconds a popup appears telling me that Atom is not responding.

I was able to reproduce the problem only on my laptop. I have tried to reinstall Atom deleting the .atom folder in my home directory.

I tried to disable my packages one by one and the result was that the program hangs only when both the "linter" and the "linter-clang" package are enabled. I've tried also to install only those two packages and I was able to reproduce the problem.

I tried to install another linter package, "linter-csslint", and there is no problem in linting CSS files so I deduced that the problem was related to this package.

If I try to open a file from command line, instead that clicking on the TreeView, everything works perfectly.

The problem was not present on previous versions of Atom, it started with Atom 0.181.

I'm on Arch Linux, kernel 3.18.6, clang 3.5.1.
I installed Atom with an AUR package called "atom-editor-bin".

I doubt that the problem is directly caused by this package but I have no clue on how to resolve it, ask for any other information you may need.

Package.activateConfig is deprecated.

Use a config schema instead. See the configuration section
of https://atom.io/docs/latest/hacking-atom-package-word-count and
https://atom.io/docs/api/latest/Config for more details

Package.activateConfig (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:247:11)
Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:218:14)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:203:30)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:147:15)

Package.activateConfig is deprecated.

Use a config schema instead. See the configuration section
of https://atom.io/docs/latest/hacking-atom-package-word-count and
https://atom.io/docs/api/latest/Config for more details

Package.activateConfig (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:263:11)
Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:234:14)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:219:30)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:163:15)
Package.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:211:14)
PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:435:21)

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 (/usr/share/atom/resources/app.asar/src/package.js:810:9)
Package.hasActivationCommands (/usr/share/atom/resources/app.asar/src/package.js:735:20)
<unknown> (/usr/share/atom/resources/app.asar/src/package.js:189:24)
Package.measure (/usr/share/atom/resources/app.asar/src/package.js:167:15)

Linter clang doesn't work

I've just installed it on Atom Ubuntu, and it really doesn't work (it does nothing).

I've try to use the devtools to debug it, but I haven't figured out what's wrong : it gets into the lintFile function, but the Linter plugin display "null returned" everytime. I've launched the command in the terminal, and it returns what it should return (including errors).

Don't search recursively

Searching the whole project directory for the .linter-clang-include files recursively is a problem when te directory has many files because it slows down atom.
Possible fixes:

  • Let the package have a setting where the recursive search can be limited by 1) totally turning it off (e.g. only having one .linter-clang-include), 2) ignoring certain directories and/or 3) specifying a maximum depth level to search.
  • Don't search recursively at all - enter at the first .linter-clang-include in the root directory and if the user wants to have more of those files they can specfigy those in the .linter-clang-include file.
    For example we have .linter-clang-include at the root dir and one in a directory foo and one in a directory foo/bar/.
    Now, in the file in the root dir we tell linter-clang to load the file inside foo, and in the file inside foo we tell linter-clang to load the file inside bar (which is a relative path).

The first fix is easier, the second fix is a bit harder but more efficient.

Related to #52

Warnings from other files

linter-clang also shows warnings, which are not present in my code, but in the code #included. For example a warning about hiding members occured at the includefile xy.h in line 65, and then this exact warning appears in my code (which included xy.h) at line 65, which is wrong of course... The linter has to check for which file the warning was meant to be.

Package.activateConfig is deprecated.

Use a config schema instead. See the configuration section
of https://atom.io/docs/latest/hacking-atom-package-word-count and
https://atom.io/docs/api/latest/Config for more details

Package.activateConfig (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:263:11)
Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:234:14)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:219:30)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:163:15)
Package.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:211:14)
PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:435:21)

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 (C:\Users\Ming\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:790:9)
Package.hasActivationCommands (C:\Users\Ming\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:715:20)
<unknown> (C:\Users\Ming\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:169:24)
Package.measure (C:\Users\Ming\AppData\Local\atom\app-0.196.0\resources\app.asar\src\package.js:147:15)

Clang fails to locate neighboring header files while in subdirectories

No matter how deep you are in a directory tree, clang will only have the root project directory in the include path. My expected behavior is that clang should always have the directory of the file you are currently processing in its include path.

Reproduction:

  1. Create an empty folder and open it in Atom.
  2. Create a subdirectory named subdir.
  3. Add files named "sub.hpp" and "sub.cpp" to the subdirectory.
  4. Open sub.cpp and type in #include "sub.hpp".

This will produce an error stating 'sub.hpp' file not found. Example shown below.
Image of problem and directory tree

In this example, I also determine that the problem does not affect files in the root project directory.
Works fine

Multiple root support

When multiple roots are used, only the first one is used for .linter-clang-includes and friends (projectPath = atom.project.getPaths()[0]). I guess I'd expect to use the .linter-clang-* for the root of the linted file.

Uncaught TypeError: path must be a string

I just opened a new Atom window and the exception was thrown. How to reproduce it is simple as:

  1. Open a new file
  2. Set C as file specific programming language

Atom Version: 0.176.0
System: linux 3.16.0-29-generic
Thrown From: linter-clang package, v2.22.0

Stack Trace

Uncaught TypeError: path must be a string

At fs.js:691

TypeError: path must be a string
  at TypeError (native)
  at Object.fs.readdirSync (fs.js:691:18)
  at Object.fs.readdirSync (/usr/share/atom/resources/atom/common/lib/asar.js:398:26)
  at searchDirectory (/home/giulio/.atom/packages/linter-clang/lib/linter-clang.coffee:91:17)
  at LinterClang.lintFile (/home/giulio/.atom/packages/linter-clang/lib/linter-clang.coffee:120:5)
  at /home/giulio/.atom/packages/linter/lib/linter-view.coffee:139:18
  at Array.forEach (native)
  at /home/giulio/.atom/packages/linter/lib/linter-view.coffee:138:18
  at Object.oncomplete (fs.js:93:15)

Commands

 13x -0:08.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:02.2 grammar-selector:show (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "themes": [
      "atom-dark-ui",
      "monokai"
    ]
  }
}

Installed Packages

# User
autocomplete-plus, v2.0.4
linter, v0.10.1
linter-clang, v2.22.0
linter-pep8, v0.1.0
linter-shellcheck, v0.0.6
minimap, v3.5.6
monokai, v0.12.0

# Dev
No dev packages

/cc @atom/core

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 (/usr/share/atom/resources/app.asar/src/package.js:810:9)
Package.hasActivationCommands (/usr/share/atom/resources/app.asar/src/package.js:735:20)
<unknown> (/usr/share/atom/resources/app.asar/src/package.js:189:24)
Package.measure (/usr/share/atom/resources/app.asar/src/package.js:167:15)

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 (/usr/share/atom/resources/app.asar/src/package.js:806:9)
Package.hasActivationCommands (/usr/share/atom/resources/app.asar/src/package.js:731:20)
<unknown> (/usr/share/atom/resources/app.asar/src/package.js:185:24)
Package.measure (/usr/share/atom/resources/app.asar/src/package.js:163:15)
Package.load (/usr/share/atom/resources/app.asar/src/package.js:177:12)
PackageManager.loadPackage (/usr/share/atom/resources/app.asar/src/package-manager.js:355:14)

Uncaught Error: ENOENT, no such file or directory '/home/<user>/.config/google-chrome/SingletonCookie'

[Enter steps to reproduce below:]

  1. Have at least one Google Chrome window currently open.
  2. Run Atom (from command line or otherwise).
  3. Attempt to use linter-clang.

Atom Version: 0.176.0
System: linux 3.13.0-44-generic
Thrown From: linter-clang package, v2.22.0

Stack Trace

Uncaught Error: ENOENT, no such file or directory '/home//.config/google-chrome/SingletonCookie'

At /usr/share/atom/resources/atom/common/lib/asar.js:52

Error: ENOENT, no such file or directory '/home/<user>/.config/google-chrome/SingletonCookie'
  at Error (native)
  at fs.statSync (fs.js:726:18)
  at Object.fs.statSync (/usr/share/atom/resources/atom/common/lib/asar.js:155:14)
  at searchDirectory (/home/<user>/.atom/packages/linter-clang/lib/linter-clang.coffee:94:19)
  at searchDirectory (/home/<user>/.atom/packages/linter-clang/lib/linter-clang.coffee:96:11)
  at searchDirectory (/home/<user>/.atom/packages/linter-clang/lib/linter-clang.coffee:96:11)
  at LinterClang.lintFile (/home/<user>/.atom/packages/linter-clang/lib/linter-clang.coffee:120:5)
  at /home/<user>/.atom/packages/linter/lib/linter-view.coffee:139:18
  at Array.forEach (native)
  at /home/<user>/.atom/packages/linter/lib/linter-view.coffee:138:18
  at Object.oncomplete (fs.js:93:15)

Commands

     -0:11.3 application:new-file (atom-pane.pane.active.with-minimap)
  2x -0:08.1 editor:newline (atom-text-editor.editor.is-focused)
     -0:06.1 snippets:next-tab-stop (atom-text-editor.editor.is-focused)
     -0:06.1 snippets:expand (atom-text-editor.editor.is-focused)
     -0:06.1 editor:indent (atom-text-editor.editor.is-focused)
  4x -0:05.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:02.6 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "themes": [
      "atom-dark-ui",
      "monokai"
    ],
    "projectHome": "/home/<user>/GitHub"
  },
  "linter-clang": {
    "clangDefaultCFlags": "-Wall -Wextra --pedantic -std=c99"
  }
}

Installed Packages

# User
linter, v0.10.1
linter-clang, v2.22.0
linter-javac, v0.1.3
linter-pylint, v0.2.0
minimap, v3.5.6
monokai, v0.11.0

# Dev
No dev packages

/cc @atom/core

Package.activateConfig is deprecated.

Use a config schema instead. See the configuration section
of https://atom.io/docs/latest/hacking-atom-package-word-count and
https://atom.io/docs/api/latest/Config for more details

Package.activateConfig (/usr/share/atom/resources/app.asar/src/package.js:267:11)
Package.activateNow (/usr/share/atom/resources/app.asar/src/package.js:238:14)
<unknown> (/usr/share/atom/resources/app.asar/src/package.js:223:30)
Package.measure (/usr/share/atom/resources/app.asar/src/package.js:167:15)

Failed to spawn command `undefined`

Whenever linter-clang tries to process a file since the latest package update (2.9.0), I get the following error in the console:

Uncaught BufferedProcessError: Failed to spawn command `undefined`. Make sure `undefined` is installed and on your PATH [/usr/share/atom/resources/app/src/buffered-process.js:96]
(anonymous function) [/usr/share/atom/resources/app/src/buffered-process.js:96]
emit [events.js:107]
ChildProcess._handle.onexit [child_process.js:1070]
(anonymous function) [child_process.js:1142]
_tickCallback [node.js:378]

This is independent of what I set "Clang command" and "Clang Plus Plus Command" to in the settings.

Add dependency 'Linter'?

Since this package needs the package to work properly, doesn't it make sense to add 'Linter' as a dependency so that it will be downloaded automatically? This could save a lot of pain (I forgot to download Linter when I first used linter-clang, too)

Package.activateConfig is deprecated.

Use a config schema instead. See the configuration section
of https://atom.io/docs/latest/hacking-atom-package-word-count and
https://atom.io/docs/api/latest/Config for more details

Package.activateConfig (/usr/share/atom/resources/app.asar/src/package.js:263:11)
Package.activateNow (/usr/share/atom/resources/app.asar/src/package.js:234:14)
<unknown> (/usr/share/atom/resources/app.asar/src/package.js:219:30)
Package.measure (/usr/share/atom/resources/app.asar/src/package.js:163:15)
Package.activate (/usr/share/atom/resources/app.asar/src/package.js:211:14)
PackageManager.activatePackage (/usr/share/atom/resources/app.asar/src/package-manager.js:435:21)

Uncaught Error: ENOENT, no such file or directory '/Users/Rohan/.Trash/LaTeXiT (2.6.1).app/Contents/Frameworks/LinkBack.framework/Headers/Headers'

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 0.176.0
System: Mac OS X 10.10.1
Thrown From: linter-clang package, v2.22.0

Stack Trace

Uncaught Error: ENOENT, no such file or directory '/Users/Rohan/.Trash/LaTeXiT (2.6.1).app/Contents/Frameworks/LinkBack.framework/Headers/Headers'

At fs.js:726

Error: ENOENT, no such file or directory '/Users/Rohan/.Trash/LaTeXiT (2.6.1).app/Contents/Frameworks/LinkBack.framework/Headers/Headers'
  at Error (native)
  at fs.statSync (fs.js:726:18)
  at Object.fs.statSync (/Applications/Atom.app/Contents/Resources/atom/common/lib/asar.js:155:14)
  at searchDirectory (/Users/Rohan/.atom/packages/linter-clang/lib/linter-clang.coffee:94:19)
  at searchDirectory (/Users/Rohan/.atom/packages/linter-clang/lib/linter-clang.coffee:96:11)
  at searchDirectory (/Users/Rohan/.atom/packages/linter-clang/lib/linter-clang.coffee:96:11)
  at searchDirectory (/Users/Rohan/.atom/packages/linter-clang/lib/linter-clang.coffee:96:11)
  at searchDirectory (/Users/Rohan/.atom/packages/linter-clang/lib/linter-clang.coffee:96:11)
  at searchDirectory (/Users/Rohan/.atom/packages/linter-clang/lib/linter-clang.coffee:96:11)
  at searchDirectory (/Users/Rohan/.atom/packages/linter-clang/lib/linter-clang.coffee:96:11)
  at LinterClang.lintFile (/Users/Rohan/.atom/packages/linter-clang/lib/linter-clang.coffee:120:5)
  at /Users/Rohan/.atom/packages/linter/lib/linter-view.coffee:139:18
  at Array.forEach (native)
  at /Users/Rohan/.atom/packages/linter/lib/linter-view.coffee:138:18
  at Object.oncomplete (fs.js:93:15)

Commands

Config

{
  "core": {
    "followSymlinks": true,
    "disabledPackages": [
      "deprecation-cop"
    ],
    "themes": [
      "atom-dark-ui",
      "monokai"
    ],
    "audioBeep": false
  },
  "linter-clang": {
    "clangCompleteFile": true,
    "clangSuppressWarnings": true
  }
}

Installed Packages

# User
atom-jshint, v1.5.0
atom-lint, v0.20.1
autoclose-html, v0.14.0
autocomplete-clang, v0.6.1
autocomplete-plus, v2.0.3
autocomplete-plus-async, v0.22.0
autocomplete-snippets, v1.0.0
color-picker, v1.4.4
emmet, v2.3.2
file-icons, v1.4.8
git-log, v0.2.0
git-tab-status, v1.5.3
highlight-line, v0.9.3
javascript-snippets, v1.0.0
jshint, v1.2.0
jsonlint, v1.0.0
language-latex, v0.4.1
latex, v0.16.0
linter, v0.10.1
linter-clang, v2.22.0
linter-cpplint, v0.1.3
linter-csslint, v0.0.11
linter-flake8, v1.2.0
linter-htmlhint, v0.0.8
linter-javac, v0.1.3
linter-jshint, v0.1.0
linter-jsonlint, v0.1.2
linter-jsxhint, v0.1.0
linter-pylama, v0.0.15
linter-pylint, v0.2.0
markdown-preview-plus, v1.1.0
mathjax-wrapper, v0.1.0
meteor-api, v2.9.0
minimap, v3.5.6
monokai, v0.12.0
pdf-view, v0.15.0
project-manager, v1.15.5
react, v0.9.7
save-session, v0.11.3
script, v2.16.0
terminal-status, v1.3.5
travis-ci-status, v0.11.2
vim-mode, v0.30.0

# Dev
No dev packages

/cc @atom/core

Value of 'language' is an issue for clang 3.0

The value of 'language' for a c file is 'c -std=c11'. This causes clang 3.0 to throw "error: invalid value 'c11' in '-std=c11'' (I notice it supports c89 but not c11).

Is there a reason the standard is defined? Maybe that should be configurable.

Uncaught Error: ENOENT, no such file or directory

Symbolic links to non-existent files in a repository cause the clang-linter to throw an exception, when it traverses the tree to look for #include <>s. Though I'm not sure if this isn't a bug in the atom core.

Atom Version: 0.172.0
System: linux 3.18.3-1-desktop
Thrown From: linter-clang package, v2.22.0

Stack Trace

Uncaught Error: ENOENT, no such file or directory '/home/aaron/src/radare2/prefix/bin/rabin2'

At /usr/local/share/atom/resources/atom/common/lib/asar.js:52

Error: ENOENT, no such file or directory '[...]'
  at Error (native)
  at fs.statSync (fs.js:726:18)
  at Object.fs.statSync (/usr/local/share/atom/resources/atom/common/lib/asar.js:155:14)
  at searchDirectory (/home/aaron/.atom/packages/linter-clang/lib/linter-clang.coffee:94:19)
  at searchDirectory (/home/aaron/.atom/packages/linter-clang/lib/linter-clang.coffee:96:11)
  at searchDirectory (/home/aaron/.atom/packages/linter-clang/lib/linter-clang.coffee:96:11)
  at LinterClang.lintFile (/home/aaron/.atom/packages/linter-clang/lib/linter-clang.coffee:120:5)
  at /home/aaron/.atom/packages/linter/lib/linter-view.coffee:139:18
  at Array.forEach (native)
  at /home/aaron/.atom/packages/linter/lib/linter-view.coffee:138:18
  at Object.oncomplete (fs.js:93:15)

/cc @atom/core

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:806:9)
Package.hasActivationCommands (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:731:20)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:185:24)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:163:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:177:12)
PackageManager.loadPackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:355:14)

Include path

if we put the include path in the file .linter-clang-includes, it works, but if we put the include path in the setting of the package, it does not work

Package.activateConfig is deprecated.

Use a config schema instead. See the configuration section
of https://atom.io/docs/latest/hacking-atom-package-word-count and
https://atom.io/docs/api/latest/Config for more details

Package.activateConfig (/usr/share/atom/resources/app.asar/src/package.js:267:11)
Package.activateNow (/usr/share/atom/resources/app.asar/src/package.js:238:14)
<unknown> (/usr/share/atom/resources/app.asar/src/package.js:223:30)
Package.measure (/usr/share/atom/resources/app.asar/src/package.js:167:15)

EACCES, unlink '...'

Hello there, I get the following error when updating linter-clang.
EACCES, unlink '/home/USERNAME/.atom/packages/linter-clang/.npmignore'

I have recently updated Atom and this issue has come up. Thank you

Update: So I suspected it to be a perm problem and granted it permission and it updated but now I get 'Make sure clang++ is installed and on your PATH'. And I have '/usr/include/clang/3.5/include' in the PATH.

"Error reading" Problems

Hello,

Linter-clang has been working quite sporadically lately so I put Atom in dev mode to see what's going on. It seems that 4 in 5 attempts to lint a file results in an "Error reading..." error, and only works periodically.

Here's the command that's running:

clang: stderr "/usr/lib/llvm-3.5/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -disable-free -disable-llvm-verifier -main-file-name MoveTests.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.24.90 -v -dwarf-column-info -resource-dir /usr/lib/llvm-3.5/bin/../lib/clang/3.5.0 -I /redacted/test -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward -internal-isystem /usr/include/clang/3.5.0/include/ -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-3.5/bin/../lib/clang/3.5.0/include -internal-externc-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wall -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /redacted/test -ferror-limit 0 -fmessage-length 0 -fdiagnostics-print-source-range-info -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fno-caret-diagnostics -fno-diagnostics-fixit-info -fdiagnostics-show-option -x c++ /tmp/AtomLinter115213-15533-1wrlr7tsource.cpp/MoveTests.cpp

then there are a bunch of "null returned"

lang: stderr clang -cc1 version 3.5.0 based upon LLVM 3.5.0 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9"
ignoring duplicate directory "/usr/include/clang/3.5.0/include"

include "..." search starts here:

include <...> search starts here:

/redacted/test
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
/usr/include/clang/3.5.0/include
/usr/local/include
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
error: error reading '/tmp/AtomLinter115213-15533-1wrlr7tsource.cpp/MoveTests.cpp'

Any thoughts on why this may be happening? Thanks!

Package.activateConfig is deprecated.

Use a config schema instead. See the configuration section
of https://atom.io/docs/latest/hacking-atom-package-word-count and
https://atom.io/docs/api/latest/Config for more details

Package.activateConfig (/usr/share/atom/resources/app.asar/src/package.js:263:11)
Package.activateNow (/usr/share/atom/resources/app.asar/src/package.js:234:14)
<unknown> (/usr/share/atom/resources/app.asar/src/package.js:219:30)
Package.measure (/usr/share/atom/resources/app.asar/src/package.js:163:15)
Package.activate (/usr/share/atom/resources/app.asar/src/package.js:211:14)
PackageManager.activatePackage (/usr/share/atom/resources/app.asar/src/package-manager.js:435:21)

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.