You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This linter plugin for [SublimeLinter][docs]provides an interface to [codeclimate](https://github.com/codeclimate/codeclimate). Code Climate supports a variety of languages through standardized Docker images known as static analysis engines.
6
+
This SublimeLinter plugin provides an interface to the [codeclimate CLI][codeclimate]. Code Climate supports a variety of languages through standardized Docker images known as static analysis engines.
7
7
8
-
## Installation
9
-
SublimeLinter 4 must be installed in order to use this plugin. If SublimeLinter 4 is not installed, please follow the instructions [here][installation].
8
+
## Dependencies
10
9
11
-
### Linter installation
12
-
Before using this plugin, you must ensure that `codeclimate` is installed on your system. Please see the `codeclimate` documentation, specifically [Prerequisites](https://github.com/codeclimate/codeclimate#prerequisites) and [Installation](https://github.com/codeclimate/codeclimate#installation)
10
+
**SublimeLinter** and the **codeclimate CLI** must be installed to use this plugin.
13
11
14
-
### Linter configuration
15
-
In order for `codeclimate` 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"](http://sublimelinter.readthedocs.org/en/latest/troubleshooting.html#finding-a-linter-executable) through "Validating your PATH" in the documentation.
12
+
* If you haven't installed **SublimeLinter** yet, please follow the instructions [here][sublimelinter-installation].
13
+
* If you haven't installed the **codeclimate CLI** yet, please follow the instructions [here][codeclimate].
16
14
17
-
Once you have installed and configured`codeclimate`, you can proceed to install the SublimeLinter-contrib-codeclimate plugin if it is not yet installed.
15
+
It is recommended to add the`codeclimate` executable to your `$PATH` variable. You can find some [help for this step][sublimelinter-troubleshooting] in the SublimeLinter documentation. Besides, it is also possible to set a custom path to the `codeclimate` executable in the SublimeLinter settings (*[see Settings](#settings)*).
18
16
19
-
### Plugin installation
20
-
Please use [Package Control][pc] 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.
17
+
## Plugin installation
21
18
22
-
To install via Package Control, do the following:
19
+
Please use [Package Control][pc] to install the linter plugin. This will ensure that the plugin will be updated when new versions are available.
23
20
24
-
Within Sublime Text, bring up the [Command Palette][cmd] 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.
21
+
Within Sublime Text, bring up the [Command Palette][cmd] and type *install*. Select `Package Control: Install Package` and wait a few seconds while Package Control fetches the list of the available plugins.
25
22
26
-
When the plugin list appears, type `codeclimate`. Among the entries you should see `SublimeLinter-contrib-codeclimate`. If that entry is not highlighted, use the keyboard or mouse to select it.
23
+
When the plugin list appears, type *codeclimate* and select `SublimeLinter-contrib-codeclimate`.
27
24
28
25
## How it works
29
-
If the opened folder in SublimeText contains a `.codeclimate.yml` configuration file in its root, `codeclimate` will recognize this file's settings.
30
26
31
-
Suppose the `codeclimate` CLI finds no configuration file in the folder root: In that case, it will automatically run the default inspections of `structure` and `duplication`. If you have a `.codeclimate.yml` configuration file in a different folder, you can set SublimeLinter's `working_dir` setting (please see examples).
27
+
* If the opened folder in SublimeText contains a `.codeclimate.yml` configuration file in its root, `codeclimate` will recognize this file's settings. Otherwise, it will automatically run the default inspections of `structure` and `duplication`.
28
+
* If you have a `.codeclimate.yml` configuration file in a different folder, you can set SublimeLinter's `working_dir` setting (*[see Settings](#settings)*).
29
+
30
+
There are some use cases SublimeLinter can't run `codeclimate`. For instance: if you open a single file beside already opened folders in the same view. In that case, the linter will fail and print a warning because the single file has no working directory (which is required by `codeclimate`).
31
+
32
+
## Limitations
33
+
34
+
***This plugin may cause performance problems if many projects and documents are open in SublimeText.***
35
+
36
+
I recommend deactivating the plugin globally by default and then activating it depending on your opened folders or as part of a SublimeText Project.
32
37
33
38
## Settings
34
-
For general information on how SublimeLinter works with settings, please see [Settings][settings]. For information on generic linter settings, please see [Linter Settings][linter-settings].
39
+
40
+
To see how SublimeLinter's settings works, please see [settings][sublimelinter-settings] and (generic) [linter settings][sublimelinter-linter-settings] in SublimeLinter's documentation.
35
41
36
42
### Examples
43
+
44
+
Here I try to give you some examples of everyday use cases.
45
+
46
+
### Disable/enable this plugin
47
+
48
+
```json
49
+
{
50
+
"linters": {
51
+
"codeclimate": {
52
+
"disable": true
53
+
}
54
+
}
55
+
}
56
+
```
57
+
58
+
For SublimeLinter's global settings, go to *Preferences > Package Settings > SublimeLinter > Settings*.
59
+
60
+
#### Set executable
61
+
37
62
You can set the path to the `codeclimate` executable in the global SublimeLinter settings or your project settings:
38
63
39
64
```json
@@ -46,7 +71,9 @@ You can set the path to the `codeclimate` executable in the global SublimeLinter
46
71
}
47
72
```
48
73
49
-
If you want to ignore the configuration of a `.codeclimate.yml`, for instance, to run a subset of codeclimate engines, you can set linter arguments in the global SublimeLinter settings or your project settings:
74
+
#### Pass arguments to the codeclimate CLI
75
+
76
+
If you want to ignore the configuration of a `.codeclimate.yml`, for instance, to run a subset of codeclimate engines, you can set linter arguments in the global SublimeLinter settings or your project settings:
50
77
51
78
```json
52
79
{
@@ -63,6 +90,8 @@ If you want to ignore the configuration of a `.codeclimate.yml`, for instance,
63
90
}
64
91
```
65
92
93
+
#### Customize the working directory
94
+
66
95
Suppose you use a `.codeclimate.yml`-configuration file. In that case, the `codeclimate` CLI needs to be executed in your configuration file's directory. Otherwise, it can't detect your configuration and runs only the default analyzes.
67
96
68
97
SublimeLinter takes the current file's root folder in SublimeText's sidebar as the working directory for executing its linter commands. You can change this behavior by setting the working directory of execution:
@@ -79,14 +108,30 @@ SublimeLinter takes the current file's root folder in SublimeText's sidebar as t
79
108
80
109
*Hint: Make sure the working directory is in the path of the file you want to lint!*
81
110
111
+
#### Set associated file types
112
+
113
+
You can set the associated file types in the global SublimeLinter settings or your project settings:
114
+
115
+
```json
116
+
{
117
+
"linters": {
118
+
"codeclimate": {
119
+
"selector": "source.php, source.python"
120
+
}
121
+
}
122
+
}
123
+
```
124
+
125
+
> *To find out what selector to use for given file type, use the "Tools > Developer > Show Scope Name" menu entry. ([SublimeLinter documenation][sublimelinter-selector])*
126
+
82
127
## Contributing
128
+
83
129
If you would like to contribute enhancements or fixes, please do the following:
84
130
85
131
1. Fork the plugin repository.
86
-
2.Hack on a separate topic branch created from the latest `master`.
132
+
2.Do your changes on a separate topic branch created from the latest `main`.
87
133
3. Commit and push the topic branch.
88
134
4. Make a pull request.
89
-
5. Be patient.
90
135
91
136
Please note that modifications should follow these coding guidelines:
92
137
@@ -95,13 +140,19 @@ Please note that modifications should follow these coding guidelines:
95
140
- Vertical whitespace helps readability, don’t be afraid to use it.
96
141
- Please use descriptive variable names, no abbreviations unless they are very well known.
0 commit comments