Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Does not lint #36

Closed
kentwongg opened this issue Nov 13, 2015 · 42 comments
Closed

Does not lint #36

kentwongg opened this issue Nov 13, 2015 · 42 comments
Assignees
Labels

Comments

@kentwongg
Copy link

I have a fresh atom install with JDK ( Java SE Development Kit 8u66 ).
Nothing will lint, I have tried uninstalling/reinstalling/deleting my ~.atom for a fresh config/etc.

Here is my config.cson. I have tried a few things

config attempt 1:

"*":
  "exception-reporting":
    userId: "1f5fb4e1-474f-6fb5-9164-efb318e9ac10"
  welcome:
    showOnStartup: false
  core:
    themes: [
      "one-dark-ui"
      "fruits-syntax"
    ]
  editor:
    invisibles: {}
  linter: {}
  "linter-javac":
    javaExecutablePath: "C:\\Program Files\\Java\\jdk1.8.0_66\\bin"

Config attempt 2:

"*":
  "exception-reporting":
    userId: "1f5fb4e1-474f-6fb5-9164-efb318e9ac10"
  welcome:
    showOnStartup: false
  core:
    themes: [
      "one-dark-ui"
      "fruits-syntax"
    ]
  editor:
    invisibles: {}
  linter:
    path: "C:\Users\SupRa\.atom\packages\linter"
  "linter-javac":
    path:"C:\Users\SupRa\.atom\packages\linter-javac"
    javaExecutablePath: "C:\\Program Files\\Java\\jdk1.8.0_66\\bin"

Config attempt 3 (DEFAULT, AFTER INSTALLING PACKAGES):

"*":
  "exception-reporting":
    userId: "1f5fb4e1-474f-6fb5-9164-efb318e9ac10"
  welcome:
    showOnStartup: false
  core:
    themes: [
      "one-dark-ui"
      "fruits-syntax"
    ]
  editor:
    invisibles: {}
  linter: {}
@kentwongg
Copy link
Author

Ok so I tried another fresh install ( i .atom and reinstalled the atomio linter and linter-javac)

Here is my config now

"*":
  "exception-reporting":
    userId: "e4f5993e-0ba1-2f57-2495-830ca138ba1d"
  welcome:
    showOnStartup: false
  core:
    themes: [
      "one-dark-ui"
      "fruits-syntax"
    ]
  linter: {}
  editor:
    invisibles: {}
  "linter-javac":
    javaExecutablePath: "C:\\Program Files\\Java\\jdk1.8.0_66\\bin\\javac.exe"

Ok and upon trying to save a .java file, I received this error
https://gyazo.com/813c8a8e69b5c26787599693a0d4a777

But upon rebooting atom and reinstalling, the error seems to have disappeared. However it is still not linting java grammar.

i.e.

sc.nextLine();
sc.nextLine

in atom show nothing and nothing like the linter GIFS on https://atom.io/packages/linter

@kentwongg kentwongg reopened this Nov 15, 2015
@keskiju
Copy link
Contributor

keskiju commented Nov 23, 2015

I have the same problem on my Mac (OS X 10.11.1, Atom 1.2.0 and Java 8u51). It does lint however, but errors are shown on the project tab only. For current file it always says "no issues" and therefore also inline messages are not shown at all.

@Arcanemagus
Copy link
Member

This project doesn't seem to have an active maintainer, we would welcome somebody to take this over and a good first step would be diagnosing issues like this and submitting a PR 😉

My guess is that the file path the linter is outputting doesn't match the full path to the file as Atom sees it (textEditor.getPath()), messages only show on the file tab when their path matches the currently open file.

@steelbrain
Copy link
Contributor

@Arcanemagus This project does actually have a maintainer, Ping @kepler0 😛

@keskiju
Copy link
Contributor

keskiju commented Nov 24, 2015

In my case the problem was caused by a symlink. I keep all my active projects side by side in the same directory but some of them are actually symlinks that point elsewhere. In this case the project root directory was actually a symlink.

@noseglid
Copy link
Contributor

This can also happen if you have multiple root projects open and the project your currently working on is not the first one (cause: https://github.com/AtomLinter/linter-javac/blob/master/lib/init.coffee#L92)

@Ehekatl
Copy link

Ehekatl commented Dec 15, 2015

I have the same problem, other linters perform well except this, I'm on windows 10, atom 1.3.1, javac is runable in my path, but ctrl + alt + i shows that linter-javac didn't load (while *.java file open)

@florianb
Copy link
Contributor

Are there any updates on this?

@daiwenxiamen
Copy link

I have the same problem Cry cry cry

@Arcanemagus
Copy link
Member

@daiwenxiamen Do you have other linters installed that are working? Or not?
Do you see any errors in the console?
Does javac exist in your $PATH?
Does manually specifying the full path to it in the settings change anything?

@daiwenxiamen
Copy link

@Arcanemagus
NO
NO
YES I can run javac & java in cmd
YES but still not working

@florianb
Copy link
Contributor

If the issue won't be taken by anyone i'll take it over after i finished the test-suite. I beg for patience. 🍪

@Arcanemagus
Copy link
Member

@florianb You are the only current maintainer of this linter 😛.

@florianb
Copy link
Contributor

@Arcanemagus - 🙀 i somehow try to avoid that cognition..

@florianb florianb self-assigned this Feb 11, 2016
@florianb
Copy link
Contributor

@daiwenxiamen @supahkutdiamnds: This error seems to belong to a symbolic linked directory can you verify that in your project-folder (including the project-folder itself) is a symbolic linked/symlinked/softlinked folder?

Thank you very much for your support & patience! 🎁

@florianb
Copy link
Contributor

Ping. 🔔

@TAXUEZJU
Copy link

The same issue. I am on openSUSE Leap, linter-gcc works well while linter-javac never works. Javac exist in my $PATH, I also tried manually input full path in the settings but it still does not work. My project-folder is not a linked folder. Thanks for your effort. @florianb

@florianb
Copy link
Contributor

Hey @TAXUEZJU - welcome and thank you very much for your support. 🎉

This bug is currently hard to catch, mainly because of missing diagnostic information and a plenty diversity of assumptions in this thread.

I summarize:

  • We have one error message (see the 1st post telling us) is (was?) definitely dedicated to symlinks or at least a project-folder-issue.
  • We have in general the issue, that the linter is not linting - without any response.

Proposal for solution:

We will quickly introduce a "Debug"-mode (with the next minor-release) which enables verbose console logging to allow any user checking the progress of the javac-linter.

How does that sound?

@TAXUEZJU
Copy link

Sounds good. Expect next release.

@florianb
Copy link
Contributor

@TAXUEZJU done.. 👍

It would be nice if you could provide some verbose log-messages. Thanks a lot... 🎲 ⏳

@florianb florianb removed the on hold label Feb 29, 2016
@TAXUEZJU
Copy link

TAXUEZJU commented Apr 2, 2016

Sorry so long to reply to you. I have tried the debug mode, and got some useful information. It seems linter-javac does work but does not show the error information.

linter-javac:  requiring modules finished.  
linter-javac:  providing linter, examining javac-callability.  
::shadow pseudo-element is deprecated. See https://www.chromestatus.com/features/6750456638341120 for more details.
Window load time: 1623ms
/deep/ combinator is deprecated. See https://www.chromestatus.com/features/6750456638341120 for more details.
'atom-beautify.language_riot_default_beautifier' could not set the default. Attempted default: "JS Beautify"; Schema: {"title":"Language Config - Riot.js - Default Beautifier","type":"string","default":"JS Beautify","description":"Default Beautifier to be used for Riot.js","enum":["Pretty Diff"]}
linter-javac:  starting to lint.
linter-javac:  start searching java-files with "/home/taxue/Documents/Java_practice" as search-directory.
linter-javac:  collected the following arguments: -Xlint:all -cp ::.:/opt/jdk1.8.0_77/lib:/opt/jdk1.8.0_77/jre/lib
linter-javac:  adding 1 files to the javac-arguments (from "/home/taxue/Documents/Java_practice/Welcome.java" to "/home/taxue/Documents/Java_practice/Welcome.java").
linter-javac:  calling javac with 4 arguments by invoking "/opt/jdk1.8.0_77/bin/javac". The approximated command length is 113 characters long, the last argument is: /home/taxue/Documents/Java_practice/Welcome.java
linter-javac:  parsing:
/home/taxue/Documents/Java_practice/Welcome.java:11: 错误: 程序包Systm不存在
            Systm.out.println(g);
                 ^
1 个错误
linter-javac:  returning 0 linter-messages.

Obviously, it works but does not show the error information. However, linter-gcc works well. Wish it can help you. Thanks.

@florianb
Copy link
Contributor

florianb commented Apr 3, 2016

Hey @TAXUEZJU - thank you very much! This helps a lot!

😂 I haven't seen something like that yet. Oracles seems to internationalize it's system-output (i guess 错误 is chinese for "error") and since we're searching for "old" english "errors", the linter seems to miss the error-messages from javac.

I will have to take a deeper look, but i am confident we're able to fix that by at least adding a different regex.

However, i beg you for some patience. 🍻

@florianb florianb reopened this Apr 4, 2016
@florianb
Copy link
Contributor

florianb commented Apr 8, 2016

@TAXUEZJU i couldn't find any way to control javac's behavior on that issue. So i would like to try creating a RegExp-pattern for that.

Since i was completely unable to make javac speak Chinese here, i would like to ask you fro a favour.

Could you please post the output of javac --version and an example for an error- as well as a warining-output here?

Thank you very much in advance! 🍺

@TAXUEZJU
Copy link

TAXUEZJU commented Apr 9, 2016

Like this?

taxue@Leap:~/Documents/Java_practice> javac -version
javac 1.8.0_77
taxue@Leap:~/Documents/Java_practice> which javac
/opt/jdk1.8.0_77/bin/javac
taxue@Leap:~/Documents/Java_practice> javac Welcome.java -Xlint
Welcome.java:14: 错误: 找不到符号
    InputFilter hexInputFilter()
    ^
  符号:   类 InputFilter
  位置: 类 Welcome
Welcome.java:11: 错误: 程序包Systm不存在
            Systm.out.println(g);
                 ^
Welcome.java:16: 错误: 找不到符号
    return new InputFilter()
               ^
  符号:   类 InputFilter
  位置: 类 Welcome
Welcome.java:45: 警告: Welcome.ClassWithOverridingMethod中的varargsMethod(String[])覆盖了Welcome.ClassWithVarargsMethod中的varargsMethod(String...); 覆盖的方法缺少 '...'
  void varargsMethod(String[] s) { }
       ^
3 个错误
1 个警告

You mean this problem may be caused by Language settings. Chinese error information caused linter-javac unable to catch the messages. So if I try to switch to English or use old java version this problem will not exist? Thanks very much.
P.S.错误——error; 警告——warning

@TAXUEZJU
Copy link

Has the problem been solved?

@Arcanemagus
Copy link
Member

@TAXUEZJU Does this look like a valid pulling out of the relevant information?
https://regex101.com/r/rN1tA8/1

If the regex is switched to that you won't get badge highlights in the editor, but at least it will list the messages for you.

@florianb
Copy link
Contributor

@TAXUEZJU i'll prepare the patch the next week. Did you try to change the language-settings?

@TAXUEZJU
Copy link

TAXUEZJU commented Apr 25, 2016

@florianb I have tried to switch the language-settings to English and linter-javac works well. So maybe you need to add more regular expressions if you want it to work under any languages. It's hard work.

@florianb
Copy link
Contributor

florianb commented Apr 25, 2016

@TAXUEZJU - yeah i assumed that. I hadn't had the time to push the patch yet but i'll do so in the next few days.

@florianb florianb removed the untested label Apr 26, 2016
florianb pushed a commit to florianb/linter-javac that referenced this issue Apr 26, 2016
@florianb
Copy link
Contributor

The enhancement (#88) to enable chinese-localization is maturing for a few hours and will then be published later this day. 🍷

@florianb
Copy link
Contributor

@TAXUEZJU - the next minor release has been published. I would appreciate if you could prove the fix. 🍻

@Ehekatl
Copy link

Ehekatl commented Apr 26, 2016

@florianb still got problem here : (
bug

@florianb
Copy link
Contributor

florianb commented Apr 26, 2016

@Ehekatl thanks for reporting, could you please invoke javac by hand and post the output here?

It seems we're having an encoding problem at your debug console. - i guess you're using a Windows machine?

@florianb florianb reopened this Apr 26, 2016
@Ehekatl
Copy link

Ehekatl commented Apr 26, 2016

@florianb yes, I'm on windwos 10, it should be encoding problem

F:\OneDrive\PRG\Java\cooker [develop +0 ~1 -1]> javac -Xlint:all AdditionOperatorWorkspaceObject.java
AdditionOperatorWorkspaceObject.java:156: 错误: 需要<标识符>
public dsad;

           ^
AdditionOperatorWorkspaceObject.java:157: 错误: 需要<标识符>
dhasudas;
        ^
2 个错误

@florianb
Copy link
Contributor

@Ehekatl thanks a lot! 🍻

That's going to become a tough nut! 😁

@Ehekatl
Copy link

Ehekatl commented Apr 26, 2016

@florianb add -J-Dfile.encoding=UTF-8 in additional javac flags works but...

Error: Missing html/text field on Linter Response
Error: Missing html/text field on Linter Response
    at file:///C:/Users/goncc/.atom/packages/linter/lib/validate.coffee:40:19
    at Array.forEach (native)
    at Object.module.exports.Validate.messages (file:///C:/Users/goncc/.atom/packages/linter/lib/validate.coffee:27:14)
    at MessageRegistry.set (C:/Users/goncc/.atom/packages/linter/lib/message-registry.js:36:16)
    at file:///C:/Users/goncc/.atom/packages/linter/lib/linter.coffee:37:17
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\goncc\AppData\Local\atom\app-1.7.2\resources\app.asar\node_modules\event-kit\lib\emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (C:\Users\goncc\AppData\Local\atom\app-1.7.2\resources\app.asar\node_modules\event-kit\lib\emitter.js:125:28)
    at C:/Users/goncc/.atom/packages/linter/lib/linter-registry.js:66:26
    at process._tickCallback (node.js:392:9)
linter-javac:  starting to lint.
init.coffee:302 linter-javac:  start searching java-files with "F:\OneDrive\PRG\Java\cooker" as search-directory.
init.coffee:302 linter-javac:  adding 1 additional javac-options.
init.coffee:302 linter-javac:  collected the following arguments: -Xlint:all -cp lib\Scenario-0.6.jar;$CLASSPATH;.;C:\Program Files\Java\jdk1.8.0_60\lib;C:\Program Files\Java\jdk1.8.0_60\lib\tools.jar -J-Dfile.encoding=UTF-8
init.coffee:302 linter-javac:  adding 68 files to the javac-arguments (from "F:\OneDrive\PRG\Java\cooker\ActualArgsPanel.java" to "F:\OneDrive\PRG\Java\cooker\XYLayout.java").
init.coffee:302 linter-javac:  calling javac with 72 arguments by invoking "javac". The approximated command length is 3945 characters long, the last argument is: F:\OneDrive\PRG\Java\cooker\XYLayout.java
init.coffee:302 linter-javac:  parsing:
警告: [path] 错误的路径元素 "$CLASSPATH": 没有这种文件或目录
F:\OneDrive\PRG\Java\cooker\AdditionOperatorWorkspaceObject.java:158: 错误: 需要';'
dsadsad
       ^
1 个错误
1 个警告
init.coffee:302 linter-javac:  detecting languages
init.coffee:302 linter-javac:  detected the following language-code: zh
init.coffee:302 linter-javac:  returning 1 linter-messages.

@florianb
Copy link
Contributor

Oh no - i introduced accidentially a bug. Stay calm..

@florianb
Copy link
Contributor

@Ehekatl i'd vote to set -J-Dfile.encoding=UTF-8 as a standard-option.

It seems that it would even be possible to set english just for a single invocation, annoying that i didn't find that earlier: http://stackoverflow.com/questions/2444712/os-x-terminal-output-of-javac-is-garbled

florianb pushed a commit that referenced this issue Apr 26, 2016
* add chinese javac-output
* add fixtures for #36 - chinese javac-output
* add language detection
* add some tiny improvements
* add specs for message-type-translation
* implement message-type-translation
* fix regex-captures-order
* fix text/message capure
@Ehekatl
Copy link

Ehekatl commented Apr 26, 2016

@florianb 1.9.1 works well 🎉 many thx
and it's possible to set english by -J-Duser.language=en flag

@florianb
Copy link
Contributor

@Ehekatl thanks for the hint.. these findings will influence #76

🍻

@mapleriver
Copy link

It doesn't work for me for another reason.
I think this issue also relates to Chinese enconding.
I'm using Windows 10 and my Active code page is 936 which means the encoding-GB2312
I just convert Your "init.coffee" file's encoding to GB2312 and rewrite the Chinese using Notepad++(sadly Atom doesn't support GB2312 yet) and it works pretty well.
I think maybe some people who meets the similar issues can slolve the problem like this.
Sorry for my poor English.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

10 participants