ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Sublime​Linter-contrib-elixirc

by smanolloff ST3

Elixir linter for Sublime Text 3 based on SublimeLinter

Details

Installs

  • Total 7K
  • Win 2K
  • Mac 4K
  • Linux 2K
Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

NOTE: This repository is no longer maintained, as I've switched to a far-superior way of linting by using JakeBecker's elixir-ls and tom564's LSP. Be sure to check it out yourself.

SublimeLinter-contrib-elixirc

Build Status

This linter plugin for SublimeLinter provides an interface to check elixir syntax using elixirc. It will be used with files that have the “elixir” syntax.

Installation

SublimeLinter 3 must be installed in order to use this plugin. If SublimeLinter 3 is not installed, please follow the instructions here.

Linter installation

Before installing this plugin, you must ensure that elixir (>= 1.0) is installed on your system. For instructions on how to install elixir, please refer to the elixir-lang docs.

Linter configuration

In order for elixir to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. Before going any further, please read and follow the steps in “Finding a linter executable” through “Validating your PATH” in the documentation.

Once elixir is installed and configured, you can proceed to install the SublimeLinter-contrib-elixirc plugin if it is not yet installed.

Plugin installation

Please use Package Control to install the linter plugin. This will ensure that the plugin will be updated when new versions are available. If you want to install from source so you can modify the source code, you probably know what you are doing so we won’t cover that here.

To install via Package Control, do the following:

  1. Within Sublime Text, bring up the Command Palette and type install. Among the commands you should see Package Control: Install Package. If that command is not highlighted, use the keyboard or mouse to select it. There will be a pause of a few seconds while Package Control fetches the list of available plugins.

  2. When the plugin list appears, type elixirc. Among the entries you should see SublimeLinter-contrib-elixirc. If that entry is not highlighted, use the keyboard or mouse to select it.

Settings

For general information on how SublimeLinter works with settings, please see Settings. For information on generic linter settings, please see Linter Settings.

In addition to the standard SublimeLinter settings, SublimeLinter-contrib-elixirc provides its own settings.

Setting Description
pa (list) dirs for -pa option
require (list) dirs/files to require
mix_project (bool) use mix for linting
chdir (string) run linter from the specified dir
prepend (list) will be prepended to the linter command
append (list) will be appended to the linter command

In a mix project:

  • set chdir to your mix project's root directory.
  • set mix_project to true

Example:

In your .sublime-project file:

"SublimeLinter": {
      "linters": {
         "elixirc": {
            "mix_project": true,
            "chdir": "PROJECT_ROOT"
         }
      }
   }

Where: * PROJECT_ROOT is the path to the root your project (use ${project} if your sublime project is saved there)

Note: Currently, exs files within a mix project (e.g. ExUnit tests) are linted for syntax errors only. This is a known issue and will be resolved in a future version.

If you also use an elixir version manager, set prepend as per the example below

Outside a mix project:

  • if a file uses macros, the beam output paths must be added to code path through pa
  • files (or directories) to require prior to linting must be added through require. They are required in the given order. Directories, if given, are traversed recursively and alphabetically.

Example

In your .sublime-project file:

"SublimeLinter": {
      "linters": {
         "elixirc": {
            "pa": ["PROJECT_ROOT/_build/dev/lib/PROJECT_WITH_MACROS/ebin"],
            "require": ["PROJECT_ROOT/deps/DEP1"]
         }
      }
   }

Where: * PROJECT_ROOT is the path to the root of your project (use ${project} if your sublime project is saved there) * PROJECT_WITH_MACROS is the project name which contains the macros. List all projects in pa * DEP1 is a directory with files to require. If needed, list specific files first.

Command customization

The prepend and append options allow you to modify the executed command.

A typical use-case for this would be if you use elixir version managers (e.g. kiex), which alter certain environment variables when switching between different versions of elixir.

Since sublime is very limited in terms of user-configurable environment variables, the problem could be solved with the env command on any typical UNIX-based OS.

Example

"SublimeLinter": {
      "linters": {
        "elixirc": {
          "chdir": "/Users/foo/projects/myapp",
          "mix_project": true,
          "prepend": ["/usr/bin/env", "MIX_ARCHIVES=/Users/foo/.kiex/mix/archives/elixir-1.3.3"]
        }
      }
    }

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. Be patient. ;-)

Please note that modifications should follow these coding guidelines:

  • Indent is 4 spaces.
  • Code should pass flake8 and pep257 linters.
  • Vertical whitespace helps readability, don’t be afraid to use it.
  • Please use descriptive variable names, no abbreviations unless they are very well known.

Thank you for helping out!