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
Copy file name to clipboardExpand all lines: README.md
+130Lines changed: 130 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,136 @@ Example: `pos-cli audit`
91
91
92
92
This command checks your application files for issues using static analysis, helping you maintain code quality and identify potential errors.
93
93
94
+
### Liquid Code Quality Check
95
+
96
+
pos-cli provides a powerful Liquid code quality checker powered by platformos-check. This helps you catch issues early, enforce best practices, and maintain high-quality code.
97
+
98
+
#### Initialize Configuration
99
+
100
+
Before running checks, you can create a `.platformos-check.yml` configuration file to customize which checks to run:
101
+
102
+
pos-cli check init [path]
103
+
104
+
Example: `pos-cli check init`
105
+
106
+
This creates a `.platformos-check.yml` file that:
107
+
- Extends the recommended platformos-check configuration
108
+
- Ignores `node_modules/**` by default
109
+
- Includes all available settings as comments for easy customization
110
+
111
+
#### Run Checks
112
+
113
+
To check your Liquid code quality, use:
114
+
115
+
pos-cli check run [path]
116
+
117
+
Example: `pos-cli check run`
118
+
119
+
This command analyzes Liquid templates for common issues, syntax errors, and best practices violations. By default, it checks the current directory, but you can specify a path to check a specific directory.
120
+
121
+
The output includes:
122
+
-**Severity levels**: Errors, warnings, and info messages color-coded for easy identification
123
+
-**Code snippets**: Shows the actual problematic code with line numbers
124
+
-**Grouped by file**: Offenses are organized by file for better readability
125
+
-**Summary counts**: Total offenses broken down by severity
126
+
127
+
#### Options
128
+
129
+
-`-a` - Enable automatic fixing of issues where possible
130
+
-`-f <format>` - Output format: `text` (default) or `json`
131
+
-`-s, --silent` - Only show errors, no success messages
132
+
133
+
#### Examples
134
+
135
+
Check current directory:
136
+
137
+
pos-cli check run
138
+
139
+
Check specific directory:
140
+
141
+
pos-cli check run ./app/views
142
+
143
+
Auto-fix issues:
144
+
145
+
pos-cli check run -a
146
+
147
+
JSON output for CI/CD:
148
+
149
+
pos-cli check run -f json
150
+
151
+
Silent mode (no success message):
152
+
153
+
pos-cli check run -s
154
+
155
+
Combined options:
156
+
157
+
pos-cli check run -a -f json
158
+
159
+
The command exits with code 0 if no issues are found, or 1 if issues are detected, making it suitable for CI/CD pipelines.
160
+
161
+
#### Output Format
162
+
163
+
**Text output** displays offenses grouped by file with code snippets:
164
+
165
+
```
166
+
3 offenses found in 1 file:
167
+
3 warnings
168
+
169
+
app/views/pages/index.liquid
170
+
171
+
[warning] UndefinedObject
172
+
Unknown object 'user' used.
173
+
174
+
5 <p>{{ user.name }}</p>
175
+
```
176
+
177
+
**JSON output** provides structured data with severity counts:
178
+
179
+
```json
180
+
{
181
+
"offenseCount": 3,
182
+
"fileCount": 1,
183
+
"errorCount": 0,
184
+
"warningCount": 3,
185
+
"infoCount": 0,
186
+
"files": [
187
+
{
188
+
"path": "app/views/pages/index.liquid",
189
+
"offenses": [...],
190
+
"errorCount": 0,
191
+
"warningCount": 3,
192
+
"infoCount": 0
193
+
}
194
+
]
195
+
}
196
+
```
197
+
198
+
#### Configuration File
199
+
200
+
After running `pos-cli check init`, you can customize `.platformos-check.yml`:
201
+
202
+
```yaml
203
+
extends: platformos-check:recommended
204
+
ignore:
205
+
- node_modules/**
206
+
- dist/**
207
+
208
+
# Customize individual checks
209
+
UndefinedObject:
210
+
enabled: true
211
+
severity: error # error (0), warning (1), or info (2)
212
+
213
+
DeprecatedFilter:
214
+
enabled: true
215
+
severity: warning
216
+
```
217
+
218
+
The configuration file controls:
219
+
- Which checks are enabled/disabled
220
+
- Severity levels for each check
221
+
- File patterns to ignore
222
+
- Check-specific settings
223
+
94
224
### Reading Logs
95
225
96
226
Use the `logs` command to access errors and logs that you or the system logs:
0 commit comments