Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flycheck-define-linter isn't working for me #1537

Closed
treymerkley opened this issue Jan 21, 2019 · 10 comments
Closed

flycheck-define-linter isn't working for me #1537

treymerkley opened this issue Jan 21, 2019 · 10 comments

Comments

@treymerkley
Copy link

  • What you did, and what you expected to happen instead
    I followed this guide with the intention of setting up inline syntax checking by combining this with flycheck-inline. Here's my relevant part of the init:
;; flycheck
(use-package flycheck
  :ensure t
  :init (global-flycheck-mode)
  :diminish flycheck-mode
  :config
  (flycheck-define-checker textlint
    "A linter for textlint."
    ;; http://www.macs.hw.ac.uk/~rs46/posts/2018-12-29-textlint-flycheck.html
    :command ("npx" "textlint"
              "--config" "/home/trey/.emacs.d/.textlintrc"
              "--format" "unix"
              "--rule" "write-good"
              "--rule" "no-start-duplicated-conjunction"
              "--rule" "max-comma"
              "--rule" "terminology"
              "--rule" "period-in-list-item"
              "--rule" "abbr-within-parentheses"
              "--rule" "alex"
              "--rule" "common-misspellings"
              "--rule" "en-max-word-count"
              "--rule" "diacritics"
              "--rule" "stop-words"
              "--plugin"
              (eval
               (if (derived-mode-p 'tex-mode)
                   "latex"
  		 "@textlint/text"))
              source-inplace)
    :error-patterns
    ((warning line-start (file-name) ":" line ":" column ": "
              (message (one-or-more not-newline)
                       (zero-or-more "\n" (any " ") (one-or-more not-newline)))
              line-end))
    :modes (text-mode latex-mode org-mode markdown-mode)
    )
  (add-to-list 'flycheck-checkers 'textlint)
  )
  • Whether and how you were able to [reproduce the issue in emacs -Q][emacsQ]
    I'm not actually sure how I would go about testing this but if you'll let me know how to I'd be happy to.

  • Your Flycheck setup from M-x flycheck-verify-setup

Syntax checkers for buffer Project1.org in org-mode:

  textlint
    - may enable: yes
    - executable: Found at /usr/bin/npx


The following syntax checkers are not registered:

  - csharp-omnisharp-codecheck

Try adding these syntax checkers to `flycheck-checkers'.  Flycheck
Mode is enabled.  Use C-u C-c ! x to enable disabled checkers.

--------------------

Flycheck version: 32snapshot (package: 20190108.351)
Emacs version:    26.1
System:           x86_64-pc-linux-gnu
Window system:    x

It looks to be enabled, but when run, no errors are reported, even though I can see the error squiggle indicators for another implementation of the same linters.

  • Your operating system
    Manjaro Linux 64-bit, up to date.

  • Your Emacs version from M-x emacs-version
    GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-07-05

  • Your Flycheck version from M-x flycheck-version
    Flycheck version: 32snapshot (package: 20190108.351)

@fmdkdd
Copy link
Member

fmdkdd commented Jan 22, 2019

even though I can see the error squiggle indicators for another implementation of the same linters.

You could check the output of flycheck-compile for your textlint. Or you could wait for #1534 to land which shouldn't take long.

@treymerkley
Copy link
Author

Thanks for your reply! I'll probably use it too, but until then here's flycheck-compile:

-*- mode: compilation; default-directory: "~/Project Directory -*-
Compilation started at Tue Jan 22 17:23:16

npx textlint --config /home/user/.emacs.d/.textlintrc --format unix --rule write-good --rule no-start-duplicated-conjunction --rule max-comma --rule terminology --rule period-in-list-item --rule abbr-within-parentheses --rule alex --rule common-misspellings --rule en-max-word-count --rule diacritics --rule stop-words --plugin \@textlint/text /home/user/Project\ Directory/Project1.org

Compilation finished at Tue Jan 22 17:23:17

I don't know what to make of it.

@fmdkdd
Copy link
Member

fmdkdd commented Jan 23, 2019

From this output, looks like textlint did not report any error for your file. Can you check against the output of the same command in a terminal?

@treymerkley
Copy link
Author

Yeah, nothing. That's pretty strange, because like I said, I can see the write-good errors. Running with debug, I get:

textlint:cli Running on files, stdin-filename: undefined +0ms
textlint:module-loader config Config {
textlint:module-loader   configFile: undefined,
textlint:module-loader   rulesBaseDirectory: undefined,
textlint:module-loader   rules:
textlint:module-loader    [ 'write-good',
			    textlint:module-loader      'no-start-duplicated-conjunction',
			    textlint:module-loader      'max-comma',
			    textlint:module-loader      'terminology',
			    textlint:module-loader      'period-in-list-item',
			    textlint:module-loader      'abbr-within-parentheses',
			    textlint:module-loader      'alex',
			    textlint:module-loader      'common-misspellings',
			    textlint:module-loader      'en-max-word-count',
			    textlint:module-loader      'diacritics',
			    textlint:module-loader      'stop-words' ],
textlint:module-loader   disabledRules: [],
textlint:module-loader   filterRules: [],
textlint:module-loader   disabledFilterRules: [],
textlint:module-loader   presets: [],
textlint:module-loader   plugins: [ '@textlint/text' ],
textlint:module-loader   pluginsConfig: {},
textlint:module-loader   rulesConfig: {},
textlint:module-loader   filterRulesConfig: {},
textlint:module-loader   rulePaths: [],
textlint:module-loader   formatterName: 'unix',
textlint:module-loader   quiet: false,
textlint:module-loader   color: true,
textlint:module-loader   cache: false,
textlint:module-loader   cacheLocation: '/home/user/.textlintcache' } +0ms
textlint:module-loader Loading rules from /home/user/node_modules/textlint-rule-write-good/lib/write-good.js +4ms
textlint:module-loader Loading rules from /home/user/node_modules/textlint-rule-no-start-duplicated-conjunction/lib/no-start-duplicated-conjunction.js +10ms
textlint:module-loader Loading rules from /home/user/node_modules/textlint-rule-max-comma/lib/textlint-rule-max-comma.js +17ms
textlint:module-loader Loading rules from /home/user/node_modules/textlint-rule-terminology/index.js +2ms
textlint:module-loader Loading rules from /home/user/node_modules/textlint-rule-period-in-list-item/lib/textlint-rule-period-in-list-item.js +29ms
textlint:module-loader Loading rules from /home/user/node_modules/textlint-rule-abbr-within-parentheses/lib/textlint-rule-abbr-within-parentheses.js +16ms
textlint:module-loader Loading rules from /home/user/node_modules/textlint-rule-alex/lib/textlint-rule-alex.js +4ms
textlint:module-loader Loading rules from /home/user/node_modules/textlint-rule-common-misspellings/lib/common-misspellings.js +73ms
textlint:module-loader Loading rules from /home/user/node_modules/textlint-rule-en-max-word-count/lib/textlint-rule-en-max-word-count.js +3ms
textlint:module-loader Loading rules from /home/user/node_modules/textlint-rule-diacritics/index.js +2ms
textlint:module-loader Loading rules from /home/user/node_modules/textlint-rule-stop-words/index.js +1ms
textlint:module-loader Loading rules from plugin: /home/user/node_modules/@textlint/textlint-plugin-text/lib/index.js +1ms
textlint:engine-core Process files [] +0ms
textlint:engine-core Not Process files [] +0ms
textlint:@textlint/linter-formatter try formatterName: unix +0ms

Do you see anything suspicious in this?

@fmdkdd
Copy link
Member

fmdkdd commented Jan 25, 2019

Do you see anything suspicious in this?

No, but then again I don't really know textlint internals. Is that the output from running textlint on the same file in the terminal?

@treymerkley
Copy link
Author

Yeah, but with debug on. Without debug there is no output.

@fmdkdd
Copy link
Member

fmdkdd commented Jan 25, 2019

Ah well, if the program itself has no output, then Flycheck cannot have any. Seems like there is nothing wrong with the checker. You should try to get some output from textlint first.

BTW I merged #1534.

@treymerkley
Copy link
Author

Is it supposed to be callable from `M-x'? I can't find anything for textlint.

@fmdkdd
Copy link
Member

fmdkdd commented Jan 31, 2019

Is it supposed to be callable from `M-x'? I can't find anything for textlint.

Are you refering to the built-in textlint checker that I merged? You'll need to update Flycheck to the latest version to see it.

Otherwise, I was suggesting that you run textlint in the terminal and understand why it was not reporting any errors in your files. Flycheck just parses errors and put them in your buffer. If there are no errors for a file, nothing appears.

@treymerkley
Copy link
Author

This is definitely a textlint problem so I'm going to go ahead and close this.

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

No branches or pull requests

2 participants