Skip to content

Commit e0778e5

Browse files
authored
Merge pull request #5 from meengit/improvements
Improvements
2 parents 05597a8 + 7c3028d commit e0778e5

File tree

7 files changed

+138
-49
lines changed

7 files changed

+138
-49
lines changed

.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 120
3+
ignore = D202

.sublimelinterrc

Lines changed: 0 additions & 14 deletions
This file was deleted.

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: python
2-
python:
3-
- "3.3"
2+
python: ["3.8"]
3+
44
# command to install dependencies
55
install:
66
- pip install flake8
@@ -9,3 +9,8 @@ install:
99
script:
1010
- flake8 . --max-line-length=120
1111
- pydocstyle . --add-ignore=D202
12+
branches:
13+
only:
14+
- develop
15+
- main
16+
- master

LICENSE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
The MIT License (MIT)
2+
3+
Written by Noah Davis
4+
Copyright (c) 2016 Noah Davis
5+
6+
Updated by Schuyler Jager & Andreas for SublimeLinter 4
7+
Copyright (c) 2020 Schuyler Jager & Andreas
8+
9+
Maintained since 2021 by Andreas
10+
Copyright (c) 2021-present Andreas and Contributors
11+
112
Permission is hereby granted, free of charge, to any person obtaining a copy
213
of this software and associated documentation files (the "Software"), to deal
314
in the Software without restriction, including without limitation the rights

README.md

Lines changed: 78 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,64 @@
11
SublimeLinter-contrib-codeclimate
22
=================================
33

4-
[![Build Status](https://travis-ci.org/codeclimate/SublimeLinter-contrib-codeclimate.svg?branch=master)](https://travis-ci.org/codeclimate/SublimeLinter-contrib-codeclimate)
4+
[![Build Status](https://travis-ci.com/meengit/SublimeLinter-contrib-codeclimate.svg?branch=main)](https://travis-ci.com/meengit/SublimeLinter-contrib-codeclimate)
55

6-
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.
77

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
109

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.
1311

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].
1614

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)*).
1816

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
2118

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.
2320

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.
2522

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`.
2724

2825
## 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.
3026

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.
3237

3338
## 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.
3541

3642
### 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+
3762
You can set the path to the `codeclimate` executable in the global SublimeLinter settings or your project settings:
3863

3964
```json
@@ -46,7 +71,9 @@ You can set the path to the `codeclimate` executable in the global SublimeLinter
4671
}
4772
```
4873

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:
5077

5178
```json
5279
{
@@ -63,6 +90,8 @@ If you want to ignore the configuration of a `.codeclimate.yml`, for instance,
6390
}
6491
```
6592

93+
#### Customize the working directory
94+
6695
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.
6796

6897
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
79108

80109
*Hint: Make sure the working directory is in the path of the file you want to lint!*
81110

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+
82127
## Contributing
128+
83129
If you would like to contribute enhancements or fixes, please do the following:
84130

85131
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`.
87133
3. Commit and push the topic branch.
88134
4. Make a pull request.
89-
5. Be patient.
90135

91136
Please note that modifications should follow these coding guidelines:
92137

@@ -95,13 +140,19 @@ Please note that modifications should follow these coding guidelines:
95140
- Vertical whitespace helps readability, don’t be afraid to use it.
96141
- Please use descriptive variable names, no abbreviations unless they are very well known.
97142

98-
Thank you for helping out!
143+
Thank you very much for helping out!
99144

145+
## License
146+
147+
[MIT, see LICENSE][license]
148+
149+
[cmd]: http://docs.sublimetext.info/en/sublime-text-3/extensibility/command_palette.html
150+
[codeclimate]: https://github.com/codeclimate/codeclimate
100151
[docs]: http://sublimelinter.readthedocs.org
101-
[installation]: http://sublimelinter.readthedocs.org/en/latest/installation.html
102-
[locating-executables]: http://sublimelinter.readthedocs.org/en/latest/usage.html#how-linter-executables-are-located
152+
[license]: https://github.com/meengit/SublimeLinter-contrib-codeclimate/blob/main/LICENSE
103153
[pc]: https://sublime.wbond.net/installation
104-
[cmd]: http://docs.sublimetext.info/en/sublime-text-3/extensibility/command_palette.html
105-
[settings]: http://sublimelinter.readthedocs.org/en/latest/settings.html
106-
[linter-settings]: http://sublimelinter.readthedocs.org/en/latest/linter_settings.html
107-
[inline-settings]: http://sublimelinter.readthedocs.org/en/latest/settings.html#inline-settings
154+
[sublimelinter-installation]: http://sublimelinter.readthedocs.org/en/latest/installation.html
155+
[sublimelinter-linter-settings]: http://sublimelinter.readthedocs.org/en/latest/linter_settings.html
156+
[sublimelinter-selector]: http://www.sublimelinter.com/en/stable/linter_settings.html#selector
157+
[sublimelinter-settings]: http://sublimelinter.readthedocs.org/en/latest/settings.html
158+
[sublimelinter-troubleshooting]: http://sublimelinter.readthedocs.org/en/latest/troubleshooting.html#finding-a-linter-executable

linter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
class Codeclimate(Linter):
2323
"""Provides an interface to codeclimate."""
24+
2425
defaults = {
2526
'selector': (
2627
'source.css, '

messages/install.txt

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,42 @@
11
SublimeLinter-contrib-codeclimate
2-
-------------------------------
3-
This linter plugin for SublimeLinter provides an interface to codeclimate.
2+
=================================
3+
4+
This SublimeLinter plugin provides an interface to the codeclimate CLI.
5+
6+
IMPORTANT!
7+
----------
8+
9+
>>> This plugin may cause performance problems if many projects
10+
and documents are open in SublimeText. <<<
11+
12+
I recommend deactivating the plugin globally by default and then activating
13+
it depending on your opened folders or as part of a SublimeText Project.
14+
15+
To make this plugin work, please read the project's README.md carefully:
16+
17+
https://github.com/meengit/SublimeLinter-contrib-codeclimate
18+
19+
CHANGELOG
20+
---------
21+
22+
2.1.0
23+
24+
Improvements
25+
26+
* Simplified documentation
27+
* Development: New Travis-CI with Python 3.8
28+
29+
Changes
30+
31+
* New package maintainer
32+
* Development: Replaced `.sublimelinterrc` with `.flake8` configuration
33+
34+
2.0.0
35+
36+
Improvements
37+
38+
* Upgraded Linter Plugin to work with SublimeLinter 4
39+
* Added Examples to README.md
440

5-
** IMPORTANT! **
641

7-
Before this plugin will activate, you *must*
8-
follow the installation instructions here:
942

10-
https://github.com/codeclimate/SublimeLinter-contrib-codeclimate

0 commit comments

Comments
 (0)