platformos-check 0.4.12 → 0.4.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/CONTRIBUTING.md +20 -18
- data/README.md +108 -57
- data/RELEASING.md +14 -7
- data/TROUBLESHOOTING.md +19 -10
- data/data/platformos_liquid/documentation/filters.json +1 -1
- data/data/platformos_liquid/documentation/latest.json +1 -1
- data/data/platformos_liquid/documentation/tags.json +1 -1
- data/docs/api/check.md +7 -6
- data/docs/api/html_check.md +12 -13
- data/docs/api/liquid_check.md +17 -21
- data/docs/api/yaml_check.md +3 -3
- data/docs/checks/TEMPLATE.md.erb +16 -11
- data/docs/checks/convert_include_to_render.md +29 -13
- data/docs/checks/deprecated_filter.md +5 -9
- data/docs/checks/form_action.md +12 -12
- data/docs/checks/form_authenticity_token.md +21 -15
- data/docs/checks/graphql_in_for_loop.md +15 -13
- data/docs/checks/html_parsing_error.md +12 -12
- data/docs/checks/img_lazy_loading.md +13 -11
- data/docs/checks/img_width_and_height.md +21 -23
- data/docs/checks/include_in_render.md +11 -11
- data/docs/checks/invalid_args.md +11 -11
- data/docs/checks/liquid_tag.md +12 -12
- data/docs/checks/missing_enable_comment.md +7 -7
- data/docs/checks/missing_template.md +14 -13
- data/docs/checks/parse_json_format.md +15 -14
- data/docs/checks/parser_blocking_javascript.md +19 -14
- data/docs/checks/required_layout_object.md +5 -7
- data/docs/checks/space_inside_braces.md +12 -12
- data/docs/checks/syntax_error.md +10 -10
- data/docs/checks/template_length.md +12 -12
- data/docs/checks/translation_files_match.md +10 -11
- data/docs/checks/translation_key_exists.md +10 -11
- data/docs/checks/undefined_object.md +11 -13
- data/docs/checks/unknown_filter.md +11 -11
- data/docs/checks/unreachable_code.md +11 -11
- data/docs/checks/unused_assign.md +11 -11
- data/docs/checks/unused_partial.md +7 -11
- data/docs/checks/valid_yaml.md +11 -11
- data/docs/language_server/how_to_correct_code_with_code_actions_and_execute_command.md +62 -70
- data/lib/platformos_check/app.rb +23 -14
- data/lib/platformos_check/app_file.rb +25 -4
- data/lib/platformos_check/asset_file.rb +1 -1
- data/lib/platformos_check/file_system_storage.rb +1 -1
- data/lib/platformos_check/form_file.rb +1 -1
- data/lib/platformos_check/graphql_file.rb +1 -1
- data/lib/platformos_check/language_server/completion_context.rb +2 -0
- data/lib/platformos_check/language_server/handler.rb +6 -6
- data/lib/platformos_check/language_server/variable_lookup_finder.rb +8 -10
- data/lib/platformos_check/layout_file.rb +1 -1
- data/lib/platformos_check/partial_file.rb +1 -1
- data/lib/platformos_check/platformos_liquid/documentation.rb +2 -2
- data/lib/platformos_check/translation_file.rb +1 -1
- data/lib/platformos_check/version.rb +1 -1
- data/platformos-check.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e71a05c1655cf1a33b9290f29812cfefffaf5c221a953536f28cd46588f604d
|
4
|
+
data.tar.gz: ecc1f13f479711da984373e405f59b5ae55c6c558eef8dc172c1d1d9670ea4e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 496da6087ec91931dec08e7a3939a0b02e0eb43051dd59f7e363a11989be1d59d097380d50628168b088728a86edd978a738e42f0d27207842312767da7f8d87
|
7
|
+
data.tar.gz: 5786d06421eefbc59bcd2c7a5eba753db923875f89c170e6918b3a46f2db94bc22a99bb723125ffe382633b93b7e60b6046af9e7f2ba62c69f6f6d6271164839
|
data/CHANGELOG.md
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -6,16 +6,16 @@
|
|
6
6
|
* PR should explain what the feature does, and why the change exists.
|
7
7
|
* PR should include any carrier specific documentation explaining how it works.
|
8
8
|
* Code _must_ be tested.
|
9
|
-
* Be consistent. Write clean code that follows [Ruby community standards](https://github.com/bbatsov/ruby-style-guide).
|
9
|
+
* Be consistent. Write clean code that follows the [Ruby community standards](https://github.com/bbatsov/ruby-style-guide).
|
10
10
|
* Code should be generic and reusable.
|
11
11
|
|
12
12
|
## How to contribute
|
13
13
|
|
14
|
-
1. Fork it (
|
15
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
16
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
17
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
18
|
-
5. Create a new Pull Request
|
14
|
+
1. Fork it (https://github.com/Platform-OS/platformos-lsp).
|
15
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
16
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
17
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
18
|
+
5. Create a new Pull Request.
|
19
19
|
|
20
20
|
## Run Language Server
|
21
21
|
|
@@ -49,9 +49,9 @@ Before configuring your IDE, run the following commands in a terminal:
|
|
49
49
|
|
50
50
|
#### Configure VS Code
|
51
51
|
|
52
|
-
1. Download provided
|
53
|
-
2. Install it manually via View -> Extensions -> ... -> Install from VSIX
|
54
|
-
3. Configure settings.json
|
52
|
+
1. Download provided `.vsix` file.
|
53
|
+
2. Install it manually via View -> Extensions -> ... -> Install from VSIX.
|
54
|
+
3. Configure `settings.json`:
|
55
55
|
|
56
56
|
```
|
57
57
|
"platformosCheck.checkOnChange": true,
|
@@ -90,8 +90,8 @@ If you use `coc.nvim` as your completion engine, add this to your CocConfig:
|
|
90
90
|
|
91
91
|
### Confirm Setup
|
92
92
|
|
93
|
-
*
|
94
|
-
* Restart your IDE, confirm the response for
|
93
|
+
* From the root of platformos-check, run `tail -f /tmp/platformos-check-debug.log` in another terminal to watch the server logs.
|
94
|
+
* Restart your IDE, confirm the response for initialization in the logs is pointing to the language server in the `$HOME/bin` directory (the version will be different).
|
95
95
|
|
96
96
|
```json
|
97
97
|
"serverInfo": {
|
@@ -118,9 +118,9 @@ bin/platformos-check /path/to/your/app
|
|
118
118
|
|
119
119
|
Run `bundle exec rake "new_check[MyNewCheckName]"` to generate all the files required to create a new check.
|
120
120
|
|
121
|
-
Check the [Check API](/docs/api/check.md) for how to implement a check. Also take a look at other checks in [lib/platformos_check/checks](/lib/platformos_check/checks).
|
121
|
+
Check the [Check API](/docs/api/check.md) for how to implement a check. Also, take a look at other checks in [lib/platformos_check/checks](/lib/platformos_check/checks).
|
122
122
|
|
123
|
-
|
123
|
+
When you're done implementing your check, add it to `config/default.yml` to enable it:
|
124
124
|
|
125
125
|
```yaml
|
126
126
|
MyNewCheckName:
|
@@ -128,7 +128,9 @@ MyNewCheckName:
|
|
128
128
|
ignore: []
|
129
129
|
```
|
130
130
|
|
131
|
-
If the check is configurable, the `initialize` argument names and default values should also be duplicated inside `config/default.yml`.
|
131
|
+
If the check is configurable, the `initialize` argument names and default values should also be duplicated inside `config/default.yml`.
|
132
|
+
|
133
|
+
For example:
|
132
134
|
|
133
135
|
```ruby
|
134
136
|
class MyCheckName < LiquidCheck
|
@@ -148,9 +150,9 @@ MyNewCheckName:
|
|
148
150
|
|
149
151
|
## Debugging
|
150
152
|
|
151
|
-
|
153
|
+
When the `PLATFORMOS_CHECK_DEBUG` environment variable is set, several features are enabled:
|
152
154
|
|
153
|
-
1. The check timeout is
|
155
|
+
1. The check timeout is disabled. This allows you to use `binding.pry` in tests and debug with `bundle exec rake tests:in_memory`.
|
154
156
|
2. The `--profile` flag appears. You can now create Flamegraphs to inspect performance.
|
155
157
|
|
156
158
|
```
|
@@ -173,7 +175,7 @@ bin/platformos-check-language-server
|
|
173
175
|
|
174
176
|
#### Flamegraph
|
175
177
|
|
176
|
-
With the `--profile` flag, you can run platformos-check on
|
178
|
+
With the `--profile` flag, you can run platformos-check on your platformOS application and the `ruby-prof-flamegraph` printer will output profiling information in a format [Flamegraph](/brendangregg/FlameGraph) understands.
|
177
179
|
|
178
180
|
|
179
181
|
**Setup:**
|
@@ -206,4 +208,4 @@ What you'll see is an interactive version of the following image:
|
|
206
208
|
|
207
209
|
## Troubleshooting
|
208
210
|
|
209
|
-
If you run into issues during development, see the [
|
211
|
+
If you run into issues during development, see the [Troubleshooting Guide](/TROUBLESHOOTING.md).
|
data/README.md
CHANGED
@@ -1,18 +1,27 @@
|
|
1
|
-
# platformOS Check ✅ - A
|
1
|
+
# platformOS Check ✅ - A Linter for platformOS
|
2
2
|
|
3
|
-
PlatformOS Check is a tool that
|
3
|
+
PlatformOS Check is a tool that checks your app’s Liquid code to make sure it follows the recommended best practices for [platformOS](https://www.platformos.com/).
|
4
|
+
This tool looks for common errors and areas where your code could be improved, helping you clean up and optimize your code by pointing out syntax mistakes, outdated elements, and performance issues.
|
4
5
|
|
5
|
-
![](docs/
|
6
|
+
![](docs/platformos-check.jpg)
|
6
7
|
|
7
8
|
## Supported Checks
|
8
9
|
|
9
|
-
PlatformOS Check currently
|
10
|
+
PlatformOS Check currently performs the following checks:
|
11
|
+
|
12
|
+
**Syntax Validation:**
|
10
13
|
|
11
14
|
✅ Liquid syntax errors
|
12
15
|
✅ JSON syntax errors
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
**Resource Verification:**
|
18
|
+
|
19
|
+
✅ Missing partials and GraphQL files
|
20
|
+
✅ Unused variables (using `{% assign var = ... %}`, {% function var = ... %} and similar tags)
|
15
21
|
✅ Unused partials
|
22
|
+
|
23
|
+
**Code Efficiency and Quality:**
|
24
|
+
|
16
25
|
✅ Template length
|
17
26
|
✅ Deprecated tags
|
18
27
|
✅ Unknown tags
|
@@ -22,57 +31,70 @@ PlatformOS Check currently checks for the following:
|
|
22
31
|
✅ Undefined objects
|
23
32
|
✅ Deprecated filters
|
24
33
|
✅ Missing `platformos-check-enable` comment
|
25
|
-
✅ Invalid arguments
|
34
|
+
✅ Invalid arguments in `{% graphql %}` tags
|
26
35
|
✅ Missing `authenticity_token` in `<form>`
|
27
36
|
✅ Unreachable code
|
28
37
|
|
29
|
-
|
38
|
+
**Performance Optimization:**
|
30
39
|
|
31
|
-
✅ [GraphQL
|
32
|
-
✅
|
33
|
-
✅ [
|
40
|
+
✅ Preventing the [use of GraphQL queries inside loops](/docs/checks/graphql_in_for_loop.md)
|
41
|
+
✅ Identifying [parser-blocking JavaScript](/docs/checks/parser_blocking_javascript.md)
|
42
|
+
✅ Ensuring `img` tags have [width and height attributes to improve loading times](/docs/checks/img_width_and_height.md)
|
34
43
|
|
35
|
-
For detailed descriptions and configuration options, [take a look at the complete list
|
44
|
+
For detailed descriptions and configuration options, [take a look at the complete list of checks](/docs/checks/).
|
36
45
|
|
37
|
-
|
46
|
+
We continually update and expand our checks. If you have suggestions, please [let us know by creating an issue](https://github.com/Platform-OS/platformos-lsp/issues).
|
38
47
|
|
39
48
|
## Installation
|
40
49
|
|
41
|
-
-
|
42
|
-
-
|
43
|
-
|
44
|
-
|
50
|
+
- Download and [install the platformOS Liquid extension](https://marketplace.visualstudio.com/items?itemName=platformOS.platformos-check-vscode)
|
51
|
+
- Choose your installation method for Ruby and platformos-check gem:
|
52
|
+
* [Using Locally Installed Ruby](#using-locally-installed-ruby)
|
53
|
+
* [Using Docker](#using-docker)
|
45
54
|
|
46
|
-
### Using
|
55
|
+
### Using Locally Installed Ruby
|
47
56
|
|
48
57
|
#### Requirements
|
49
58
|
|
50
59
|
- Ruby 3.2+
|
51
60
|
|
52
|
-
### Install
|
61
|
+
### Install Ruby and platformos-check gem
|
62
|
+
|
63
|
+
⚠️ **Note:** Please make sure you install Ruby and the gem for your user and not as root to avoid permission issues. Install without using `sudo`.
|
53
64
|
|
54
|
-
1. Download
|
65
|
+
1. Download and install Ruby version 3.2 or higher using the [Official Ruby documentation](https://www.ruby-lang.org/en/documentation/installation/).
|
55
66
|
|
56
|
-
|
67
|
+
Ensure your Ruby is 3.2 or higher:
|
68
|
+
|
69
|
+
```
|
70
|
+
ruby -v
|
71
|
+
```
|
57
72
|
|
58
|
-
|
73
|
+
⚠️ **Note:** Restart your terminal after installation.
|
59
74
|
|
60
|
-
|
61
|
-
⚠️ **Note:*** Please make sure you install ruby for your user, not the root
|
75
|
+
2. Install platformos-check gem, using:
|
62
76
|
|
63
|
-
|
77
|
+
```
|
78
|
+
gem install platformos-check
|
79
|
+
```
|
64
80
|
|
65
|
-
|
81
|
+
Confirm the installation was successful by checking the version:
|
66
82
|
|
67
|
-
|
83
|
+
```
|
84
|
+
platformos-check --version
|
85
|
+
```
|
68
86
|
|
69
|
-
|
87
|
+
If you chose this method, use `platformos-check-language-server` as a path to your language server instead of `/Users/<username/platformos-check-language-server`.
|
70
88
|
|
71
89
|
### Using Docker
|
72
90
|
|
73
|
-
|
91
|
+
To set up the PlatformOS Check Language Server using Docker, follow these steps:
|
92
|
+
|
93
|
+
#### platformOS Check Language Server
|
74
94
|
|
75
|
-
|
95
|
+
1. Create a file named `platformos-check-language-server` and ensure it's executable and placed within a directory listed in your $PATH variable.
|
96
|
+
|
97
|
+
2. Use the following script:
|
76
98
|
|
77
99
|
```bash
|
78
100
|
DIR=$(pwd)
|
@@ -89,15 +111,18 @@ exec docker run -i \
|
|
89
111
|
-e PLATFORMOS_CHECK_DEBUG_LOG_FILE=$LOG_FILE \
|
90
112
|
$IMAGE_NAME $@
|
91
113
|
```
|
92
|
-
|
114
|
+
|
115
|
+
This script downloads the latest Docker image and starts the language server. Visual Studio Code (VS Code) can manage this process automatically, but you can also run the script manually for verification if needed.
|
93
116
|
|
94
117
|
#### Troubleshooting
|
95
118
|
|
96
|
-
-
|
119
|
+
- If the `onlySingleFileChecks: true` setting does not work as expected, check your Visual Studio Code (VS Code) workspace settings. Ensure that the workspace contains only a single project.
|
97
120
|
|
98
|
-
#### PlatformOS Check
|
121
|
+
#### PlatformOS Check as a Standalone Function
|
99
122
|
|
100
|
-
PlatformOS Check can be used
|
123
|
+
PlatformOS Check can also be used as a standalone function.
|
124
|
+
|
125
|
+
1. Prepare and run the following script to set up the Docker environment:
|
101
126
|
|
102
127
|
```bash
|
103
128
|
DIR=$(pwd)
|
@@ -114,22 +139,32 @@ exec docker run -i \
|
|
114
139
|
-e PLATFORMOS_CHECK_DEBUG_LOG_FILE=$LOG_FILE \
|
115
140
|
$IMAGE_NAME $@
|
116
141
|
```
|
117
|
-
To verify installation run `platformos-check --help`.
|
118
142
|
|
119
|
-
|
143
|
+
2. To check if the tool is correctly installed up, run:
|
144
|
+
|
145
|
+
```
|
146
|
+
platformos-check --help
|
147
|
+
```
|
148
|
+
|
149
|
+
**Usage example for CI/CD:**
|
150
|
+
|
120
151
|
```
|
121
152
|
platformos-check --fail-level error
|
122
153
|
```
|
123
154
|
|
155
|
+
This setting ensures that the CI process will fail if any errors are detected during the checks.
|
156
|
+
|
124
157
|
## Configuration
|
125
158
|
|
126
|
-
|
159
|
+
To configure PlatformOS Check according to your project's needs, you create a `.platformos-check.yml` file in the root directory of your application.
|
160
|
+
|
161
|
+
See [config/default.yml](config/default.yml) for available options and their default values.
|
127
162
|
|
128
|
-
|
163
|
+
## Disable Checks with Comments
|
129
164
|
|
130
|
-
|
165
|
+
Control the behavior of PlatformOS Check within your Liquid templates using comments to disable and re-enable checks as needed.
|
131
166
|
|
132
|
-
|
167
|
+
### Temporarily Disabling All Checks
|
133
168
|
|
134
169
|
```liquid
|
135
170
|
{% # platformos-check-disable %}
|
@@ -137,7 +172,11 @@ Use Liquid comments to disable and re-enable all checks for a section of your fi
|
|
137
172
|
{% # platformos-check-enable %}
|
138
173
|
```
|
139
174
|
|
140
|
-
|
175
|
+
All checks will be ignored between the `disable` and `enable` comments.
|
176
|
+
|
177
|
+
### Disabling a Specific Check
|
178
|
+
|
179
|
+
To disable a specific check, such as `UnusedAssign`, include the check's name in the comment:
|
141
180
|
|
142
181
|
```liquid
|
143
182
|
{% # platformos-check-disable UnusedAssign %}
|
@@ -145,7 +184,9 @@ Disable a specific check by including it in the comment:
|
|
145
184
|
{% # platformos-check-enable UnusedAssign %}
|
146
185
|
```
|
147
186
|
|
148
|
-
|
187
|
+
### Disabling Multiple Checks
|
188
|
+
|
189
|
+
To disable multiple checks simultaneously, list them in a comma-separated format within the comments:
|
149
190
|
|
150
191
|
```liquid
|
151
192
|
{% # platformos-check-disable UnusedAssign,SpaceInsideBraces %}
|
@@ -153,7 +194,9 @@ Disable multiple checks by including them as a comma-separated list:
|
|
153
194
|
{% # platformos-check-enable UnusedAssign,SpaceInsideBraces %}
|
154
195
|
```
|
155
196
|
|
156
|
-
|
197
|
+
### Disabling Checks for the Entire Document
|
198
|
+
|
199
|
+
To disable a check throughout the entire document, place the disabling comment in the first line:
|
157
200
|
|
158
201
|
```liquid
|
159
202
|
{% # platformos-check-disable SpaceInsideBraces %}
|
@@ -162,9 +205,9 @@ Disable checks for the _entire document_ by placing the comment on the first lin
|
|
162
205
|
|
163
206
|
## Exit Code and `--fail-level`
|
164
207
|
|
165
|
-
|
208
|
+
Configure the exit code of platformos-check using the `--fail-level` (default: `error`) flag, which is especially useful in continuous integration (CI) scenarios. This flag helps you control at what severity level checks should cause your CI process to fail.
|
166
209
|
|
167
|
-
|
210
|
+
### Usage Examples
|
168
211
|
|
169
212
|
```
|
170
213
|
# Make CI fail on styles warnings, suggestions, and errors
|
@@ -177,19 +220,23 @@ platformos-check --fail-level suggestion path_to_app
|
|
177
220
|
platformos-check path_to_app
|
178
221
|
```
|
179
222
|
|
223
|
+
### Fail Levels
|
224
|
+
|
180
225
|
There are three fail levels:
|
181
226
|
|
182
227
|
- `error`
|
183
228
|
- `suggestion`
|
184
229
|
- `style`
|
185
230
|
|
186
|
-
Exit
|
231
|
+
### Exit Code Meanings
|
232
|
+
|
233
|
+
- 0: Success — no issues found.
|
234
|
+
- 1: Your code does not pass the specified fail level of checks.
|
235
|
+
- 2: Error in platformos-check itself — indicates a bug within the tool.
|
187
236
|
|
188
|
-
|
189
|
-
- 1: Your code doesn't pass the checks
|
190
|
-
- 2: There's a bug in platformos-check
|
237
|
+
### Customizing Check Severity
|
191
238
|
|
192
|
-
|
239
|
+
You can adjust the severity of specific checks using the `severity` attribute in your configuration file:
|
193
240
|
|
194
241
|
```yaml
|
195
242
|
DeprecateLazysizes:
|
@@ -197,17 +244,21 @@ DeprecateLazysizes:
|
|
197
244
|
severity: error
|
198
245
|
```
|
199
246
|
|
247
|
+
This configuration, for example, treats the "DeprecateLazysizes" check as an error, thus influencing the exit code according to the `--fail-level` set.
|
248
|
+
|
200
249
|
## Language Server Configurations
|
201
250
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
- `platformosCheck.onlySingleFileChecks` (default: `false`) makes it so we only check the opened files and disable "whole application" checks (e.g. UnusedPartial, TranslationKeyExists)
|
251
|
+
Configure the PlatformOS Check language server to optimize how it interacts with your files in the development environment. The following settings can be adjusted in your editor's configuration file.
|
252
|
+
|
253
|
+
In VS Code, you can set it directly in your `settings.json` file.
|
206
254
|
|
207
|
-
|
255
|
+
- `platformosCheck.checkOnOpen` (default: `true`): Automatically runs checks when a file is opened.
|
256
|
+
- `platformosCheck.checkOnChange` (default: `true`): Executes checks whenever changes are made to a file.
|
257
|
+
- `platformosCheck.checkOnSave` (default: `true`): Initiates checks every time a file is saved.
|
258
|
+
- `platformosCheck.onlySingleFileChecks` (default: `false`): Limits checks to the currently opened file, excluding checks that involve the entire application such as `UnusedPartial` or `TranslationKeyExists`.
|
208
259
|
|
209
|
-
|
260
|
+
⚠️ **Note:** Quickfixes only work on files that have been recently checked. If you have disabled the automatic checking configurations, you need to manually rerun platformos-check to enable quickfixes.
|
210
261
|
|
211
262
|
## Contributing
|
212
263
|
|
213
|
-
For guidance on
|
264
|
+
We welcome contributions from the community! For detailed guidance on how to contribute, please refer to our [contribution guidelines](/CONTRIBUTING.md). Your input helps us make the tool better for everyone.
|
data/RELEASING.md
CHANGED
@@ -1,17 +1,23 @@
|
|
1
1
|
## Releasing platformOS Check
|
2
2
|
|
3
|
-
|
3
|
+
Follow these steps to release a new version of latformOS Check:
|
4
4
|
|
5
|
-
|
5
|
+
1. **Versioning**: Refer to the [Semantic Versioning page](http://semver.org) to determine the appropriate version number for the new release based on the changes made.
|
6
|
+
|
7
|
+
2. **Update Version**: Update the version number in the `lib/platformos_check/version.rb` file. Also, replace the `PLATFORMOS_CHECK_VERSION` placeholder in the documentation for any new rules.
|
8
|
+
Use the following command to automate these updates:
|
6
9
|
|
7
10
|
```bash
|
8
11
|
VERSION="X.X.X"
|
9
12
|
rake prerelease[$VERSION]
|
10
13
|
```
|
11
14
|
|
12
|
-
3.
|
15
|
+
3. **Update Changelog**: Use the [`git changelog` command](https://github.com/tj/git-extras) to automatically update the `CHANGELOG.md` with the latest commit descriptions.
|
16
|
+
```bash
|
17
|
+
git changelog
|
18
|
+
```
|
13
19
|
|
14
|
-
4. Commit
|
20
|
+
4. **Commit and Prepare PR**: Commit the changes and prepare a pull request for review.
|
15
21
|
|
16
22
|
```bash
|
17
23
|
git checkout -b "bump/platformos-check-$VERSION"
|
@@ -20,9 +26,10 @@
|
|
20
26
|
hub compare "main:bump/platformos-check-$VERSION"
|
21
27
|
```
|
22
28
|
|
23
|
-
5. Merge your
|
29
|
+
5. **Merge PR**: After review, merge your pull request into the main branch.
|
30
|
+
|
31
|
+
6. **Create GitHub Release**: [Create a GitHub release](https://github.com/Platform-OS/platformos-lsp/releases/new) for the change using the updated version tag.
|
24
32
|
|
25
|
-
6. [Create a GitHub release](https://github.com/Platform-OS/platformos-lsp/releases/new) for the change.
|
26
33
|
|
27
34
|
```
|
28
35
|
VERSION=v1.X.Y
|
@@ -32,4 +39,4 @@
|
|
32
39
|
gh release create -t $VERSION
|
33
40
|
```
|
34
41
|
|
35
|
-
|
42
|
+
⚠️ **Note:** Incorporate relevant parts of the CHANGELOG into the release notes to provide context on the changes.
|
data/TROUBLESHOOTING.md
CHANGED
@@ -2,34 +2,43 @@
|
|
2
2
|
|
3
3
|
## Issues with Language Server
|
4
4
|
|
5
|
-
### Language
|
5
|
+
### Language Server Crashing on Startup
|
6
6
|
|
7
|
-
The following error can cause
|
7
|
+
The following error can cause Language Server to crash:
|
8
|
+
|
9
|
+
**Error Message:**
|
8
10
|
```bash
|
9
11
|
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
|
10
12
|
/Users/johndoe/.gem/ruby/3.1.2/gems/bundler-2.2.22/lib/bundler/spec_set.rb:91:in `block in materialize': Could not find ruby-prof-0.18.0 in any of the sources (Bundler::GemNotFound)
|
11
13
|
```
|
12
14
|
|
13
|
-
|
15
|
+
**Solution:**
|
16
|
+
Ensure the `platformos-check` version in the wrapper in `~/bin/platformos-check-language-server` matches the expected Ruby version. If it doesn't match the Ruby version, run the following command from the platformos-check directory:
|
14
17
|
|
15
18
|
```bash
|
16
|
-
chruby 3.1.2
|
19
|
+
chruby 3.1.2 #your `~/bin/platformos-check-language-server` ruby version
|
17
20
|
bundle install
|
18
21
|
```
|
19
22
|
|
20
|
-
|
23
|
+
If discrepancies are found, update your environment with the correct version of Ruby and re-install the necessary gems:
|
24
|
+
|
25
|
+
### Language Server Initialization Issue
|
26
|
+
|
27
|
+
**Symptom:**
|
21
28
|
|
22
|
-
|
29
|
+
The language server sends an `initialize()` request to the client but then stops responding.
|
23
30
|
|
31
|
+
**Debugging Steps:**
|
32
|
+
|
33
|
+
1. Ensure your local language server startup script includes these steps:
|
24
34
|
```bash
|
25
35
|
export PLATFORMOS_CHECK_DEBUG=true
|
26
36
|
export PLATFORMOS_CHECK_DEBUG_LOG_FILE="/tmp/platformos-check-debug.log"
|
27
37
|
touch "$PLATFORMOS_CHECK_DEBUG_LOG_FILE"
|
28
38
|
```
|
29
39
|
|
30
|
-
An example script can be found [
|
31
|
-
|
32
|
-
Open `/tmp/platformos-check-debug.log` in your IDE. Check if there are any exceptions being raised by language server.
|
40
|
+
An example script can be found [in the Contributing Guide](/CONTRIBUTING.md#run-language-server).
|
33
41
|
|
34
|
-
|
42
|
+
2. Open the debug log located at `/tmp/platformos-check-debug.log` in your IDE. Check if there are any exceptions being raised by the language server.
|
35
43
|
|
44
|
+
3. If no exceptions are found, verify that all logs are properly formatted in JSON-RPC. The language server and client communicate using JSON-RPC over `stdin` and `stdout`. Debugging statements that aren't in a JSON-RPC format might trigger unexpected behavior. This includes any logs from the language server or echo statements in your language server script.
|