@contino/tally-linux-x64 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +3 -0
- package/README.md +492 -0
- package/bin/tally +0 -0
- package/package.json +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
# tally
|
|
2
|
+
|
|
3
|
+
A fast, configurable linter for Dockerfiles and Containerfiles.
|
|
4
|
+
|
|
5
|
+
## Supported Rules
|
|
6
|
+
|
|
7
|
+
tally integrates rules from multiple sources:
|
|
8
|
+
|
|
9
|
+
| Source | Rules | Description |
|
|
10
|
+
|--------|-------|-------------|
|
|
11
|
+
| **[BuildKit](https://docs.docker.com/reference/build-checks/)** | 15+ rules | Docker's official Dockerfile checks (automatically captured) |
|
|
12
|
+
| **tally** | 3 rules | Custom rules including secret detection with [gitleaks](https://github.com/gitleaks/gitleaks) |
|
|
13
|
+
| **[Hadolint](https://github.com/hadolint/hadolint)** | 2 rules | Shell best practices (expanding) |
|
|
14
|
+
|
|
15
|
+
**See [RULES.md](RULES.md) for the complete rules reference.**
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
### NPM
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g @contino/tally
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### PyPI
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install tally-cli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### RubyGems
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
gem install tally-cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Go
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
go install github.com/tinovyatkin/tally@latest
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### From Source
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/tinovyatkin/tally.git
|
|
47
|
+
cd tally
|
|
48
|
+
go build .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Check a Dockerfile
|
|
55
|
+
tally check Dockerfile
|
|
56
|
+
|
|
57
|
+
# Check all Dockerfiles in current directory (recursive)
|
|
58
|
+
tally check .
|
|
59
|
+
|
|
60
|
+
# Check with glob patterns
|
|
61
|
+
tally check "**/*.Dockerfile"
|
|
62
|
+
|
|
63
|
+
# Exclude patterns
|
|
64
|
+
tally check --exclude "vendor/*" --exclude "test/*" .
|
|
65
|
+
|
|
66
|
+
# Check with max lines limit
|
|
67
|
+
tally check --max-lines 100 Dockerfile
|
|
68
|
+
|
|
69
|
+
# Output as JSON
|
|
70
|
+
tally check --format json Dockerfile
|
|
71
|
+
|
|
72
|
+
# Check multiple files
|
|
73
|
+
tally check Dockerfile.dev Dockerfile.prod
|
|
74
|
+
|
|
75
|
+
# Enable context-aware rules (e.g., copy-ignored-file)
|
|
76
|
+
tally check --context . Dockerfile
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### File Discovery
|
|
80
|
+
|
|
81
|
+
When given a directory, tally recursively searches for Dockerfiles using these default patterns:
|
|
82
|
+
|
|
83
|
+
- `Dockerfile`
|
|
84
|
+
- `Dockerfile.*` (e.g., `Dockerfile.dev`, `Dockerfile.prod`)
|
|
85
|
+
- `*.Dockerfile` (e.g., `api.Dockerfile`, `frontend.Dockerfile`)
|
|
86
|
+
- `Containerfile` (Podman convention)
|
|
87
|
+
- `Containerfile.*`
|
|
88
|
+
- `*.Containerfile`
|
|
89
|
+
|
|
90
|
+
Use `--exclude` to filter out unwanted files:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Exclude vendor and test directories
|
|
94
|
+
tally check --exclude "vendor/*" --exclude "test/*" .
|
|
95
|
+
|
|
96
|
+
# Exclude all .bak files
|
|
97
|
+
tally check --exclude "*.bak" .
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Rules Overview
|
|
101
|
+
|
|
102
|
+
For the complete list of all supported rules, see **[RULES.md](RULES.md)**.
|
|
103
|
+
|
|
104
|
+
### Context-Aware Rules
|
|
105
|
+
|
|
106
|
+
Some rules require build context awareness. Enable them with the `--context` flag:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Enable context-aware rules
|
|
110
|
+
tally check --context . Dockerfile
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**copy-ignored-file**: Detects when `COPY` or `ADD` commands reference files that would be excluded by `.dockerignore`. This helps catch mistakes
|
|
114
|
+
where files are copied but won't actually be included in the build.
|
|
115
|
+
|
|
116
|
+
```dockerfile
|
|
117
|
+
# .dockerignore contains: *.log
|
|
118
|
+
|
|
119
|
+
# This will trigger a warning:
|
|
120
|
+
COPY app.log /app/ # File matches .dockerignore pattern
|
|
121
|
+
|
|
122
|
+
# Heredoc sources are exempt (they're inline, not from context):
|
|
123
|
+
COPY <<EOF /app/config.txt
|
|
124
|
+
inline content
|
|
125
|
+
EOF
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Ignoring Violations
|
|
129
|
+
|
|
130
|
+
You can suppress specific violations using inline comment directives.
|
|
131
|
+
|
|
132
|
+
### Next-Line Directives
|
|
133
|
+
|
|
134
|
+
Suppress violations on the next line:
|
|
135
|
+
|
|
136
|
+
```dockerfile
|
|
137
|
+
# tally ignore=StageNameCasing
|
|
138
|
+
FROM alpine AS Build
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Global Directives
|
|
142
|
+
|
|
143
|
+
Suppress violations throughout the entire file:
|
|
144
|
+
|
|
145
|
+
```dockerfile
|
|
146
|
+
# tally global ignore=max-lines
|
|
147
|
+
FROM alpine
|
|
148
|
+
# ... rest of file is not checked for max-lines
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Multiple Rules
|
|
152
|
+
|
|
153
|
+
Suppress multiple rules with comma-separated values:
|
|
154
|
+
|
|
155
|
+
```dockerfile
|
|
156
|
+
# tally ignore=StageNameCasing,DL3006
|
|
157
|
+
FROM Ubuntu AS Build
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Adding Reasons
|
|
161
|
+
|
|
162
|
+
Document why a rule is being ignored using `;reason=` (BuildKit-style separator):
|
|
163
|
+
|
|
164
|
+
```dockerfile
|
|
165
|
+
# tally ignore=DL3006;reason=Using older base image for compatibility
|
|
166
|
+
FROM ubuntu:16.04
|
|
167
|
+
|
|
168
|
+
# tally global ignore=max-lines;reason=Generated file, size is expected
|
|
169
|
+
FROM alpine
|
|
170
|
+
|
|
171
|
+
# check=skip=StageNameCasing;reason=Legacy naming convention
|
|
172
|
+
FROM alpine AS Build
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Use `--require-reason` to enforce that all ignore directives include an explanation:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
tally check --require-reason Dockerfile
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Note: The `;reason=` syntax is a tally extension that works with all directive formats. BuildKit silently ignores the `reason` option.
|
|
182
|
+
|
|
183
|
+
### Migration Compatibility
|
|
184
|
+
|
|
185
|
+
tally supports directive formats from other linters for easy migration:
|
|
186
|
+
|
|
187
|
+
```dockerfile
|
|
188
|
+
# hadolint ignore=DL3006
|
|
189
|
+
FROM ubuntu
|
|
190
|
+
|
|
191
|
+
# hadolint global ignore=DL3008
|
|
192
|
+
FROM alpine
|
|
193
|
+
|
|
194
|
+
# check=skip=StageNameCasing
|
|
195
|
+
FROM alpine AS Build
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Suppressing All Rules
|
|
199
|
+
|
|
200
|
+
Use `all` to suppress all rules on a line:
|
|
201
|
+
|
|
202
|
+
```dockerfile
|
|
203
|
+
# tally ignore=all
|
|
204
|
+
FROM Ubuntu AS Build
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### CLI Options
|
|
208
|
+
|
|
209
|
+
| Flag | Description |
|
|
210
|
+
| -------------------------- | ---------------------------------------------------------- |
|
|
211
|
+
| `--no-inline-directives` | Disable processing of inline ignore directives |
|
|
212
|
+
| `--warn-unused-directives` | Warn about directives that don't suppress any violations |
|
|
213
|
+
| `--require-reason` | Warn about ignore directives without `reason=` explanation |
|
|
214
|
+
|
|
215
|
+
### Configuration
|
|
216
|
+
|
|
217
|
+
Inline directive behavior can be configured in `.tally.toml`:
|
|
218
|
+
|
|
219
|
+
```toml
|
|
220
|
+
[inline-directives]
|
|
221
|
+
enabled = true # Process inline directives (default: true)
|
|
222
|
+
warn-unused = false # Warn about unused directives (default: false)
|
|
223
|
+
validate-rules = false # Warn about unknown rule codes (default: false)
|
|
224
|
+
require-reason = false # Require reason= on all ignore directives (default: false)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Configuration
|
|
228
|
+
|
|
229
|
+
tally supports configuration via TOML config files, environment variables, and CLI flags.
|
|
230
|
+
|
|
231
|
+
### Config File
|
|
232
|
+
|
|
233
|
+
Create a `.tally.toml` or `tally.toml` file in your project:
|
|
234
|
+
|
|
235
|
+
```toml
|
|
236
|
+
[output]
|
|
237
|
+
format = "text" # text, json, sarif, github-actions, markdown
|
|
238
|
+
path = "stdout" # stdout, stderr, or file path
|
|
239
|
+
show-source = true # Show source code snippets
|
|
240
|
+
fail-level = "style" # Minimum severity for exit code 1
|
|
241
|
+
|
|
242
|
+
# Rule selection (Ruff-style)
|
|
243
|
+
[rules]
|
|
244
|
+
include = ["buildkit/*", "tally/*"] # Enable rules by namespace or specific rule
|
|
245
|
+
exclude = ["buildkit/MaintainerDeprecated"] # Disable specific rules
|
|
246
|
+
|
|
247
|
+
# Per-rule configuration (severity, options)
|
|
248
|
+
[rules.tally.max-lines]
|
|
249
|
+
severity = "error"
|
|
250
|
+
max = 500
|
|
251
|
+
skip-blank-lines = true
|
|
252
|
+
skip-comments = true
|
|
253
|
+
|
|
254
|
+
[rules.buildkit.StageNameCasing]
|
|
255
|
+
severity = "info" # Downgrade severity
|
|
256
|
+
|
|
257
|
+
[rules.hadolint.DL3026]
|
|
258
|
+
severity = "warning"
|
|
259
|
+
trusted-registries = ["docker.io", "gcr.io"]
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Config File Discovery
|
|
263
|
+
|
|
264
|
+
tally uses cascading config discovery similar to [Ruff](https://docs.astral.sh/ruff/configuration/):
|
|
265
|
+
|
|
266
|
+
1. Starting from the Dockerfile's directory, walks up the filesystem
|
|
267
|
+
2. Stops at the first `.tally.toml` or `tally.toml` found
|
|
268
|
+
3. Uses that config (no merging with parent configs)
|
|
269
|
+
|
|
270
|
+
This allows monorepo setups with per-directory configurations.
|
|
271
|
+
|
|
272
|
+
### Priority Order
|
|
273
|
+
|
|
274
|
+
Configuration sources are applied in this order (highest priority first):
|
|
275
|
+
|
|
276
|
+
1. **CLI flags** (`--max-lines 100`)
|
|
277
|
+
2. **Environment variables** (`TALLY_RULES_MAX_LINES_MAX=100`)
|
|
278
|
+
3. **Config file** (`.tally.toml` or `tally.toml`)
|
|
279
|
+
4. **Built-in defaults**
|
|
280
|
+
|
|
281
|
+
### Environment Variables
|
|
282
|
+
|
|
283
|
+
| Variable | Description |
|
|
284
|
+
| ---------------------------------------- | --------------------------------------------------------- |
|
|
285
|
+
| `TALLY_OUTPUT_FORMAT` | Output format (`text`, `json`, `sarif`, `github-actions`, `markdown`) |
|
|
286
|
+
| `TALLY_OUTPUT_PATH` | Output destination (`stdout`, `stderr`, or file path) |
|
|
287
|
+
| `TALLY_OUTPUT_SHOW_SOURCE` | Show source snippets (`true`/`false`) |
|
|
288
|
+
| `TALLY_OUTPUT_FAIL_LEVEL` | Minimum severity for non-zero exit |
|
|
289
|
+
| `NO_COLOR` | Disable colored output (standard env var) |
|
|
290
|
+
| `TALLY_EXCLUDE` | Glob pattern(s) to exclude files (comma-separated) |
|
|
291
|
+
| `TALLY_CONTEXT` | Build context directory for context-aware rules |
|
|
292
|
+
| `TALLY_RULES_MAX_LINES_MAX` | Maximum lines allowed |
|
|
293
|
+
| `TALLY_RULES_MAX_LINES_SKIP_BLANK_LINES` | Exclude blank lines (`true`/`false`) |
|
|
294
|
+
| `TALLY_RULES_MAX_LINES_SKIP_COMMENTS` | Exclude comments (`true`/`false`) |
|
|
295
|
+
| `TALLY_NO_INLINE_DIRECTIVES` | Disable inline directive processing (`true`/`false`) |
|
|
296
|
+
| `TALLY_INLINE_DIRECTIVES_WARN_UNUSED` | Warn about unused directives (`true`/`false`) |
|
|
297
|
+
| `TALLY_INLINE_DIRECTIVES_REQUIRE_REASON` | Require reason= on ignore directives (`true`/`false`) |
|
|
298
|
+
|
|
299
|
+
### CLI Flags
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# Specify config file explicitly
|
|
303
|
+
tally check --config /path/to/.tally.toml Dockerfile
|
|
304
|
+
|
|
305
|
+
# Override max-lines from config
|
|
306
|
+
tally check --max-lines 200 Dockerfile
|
|
307
|
+
|
|
308
|
+
# Exclude blank lines and comments from count
|
|
309
|
+
tally check --max-lines 100 --skip-blank-lines --skip-comments Dockerfile
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## Output Formats
|
|
313
|
+
|
|
314
|
+
tally supports multiple output formats for different use cases.
|
|
315
|
+
|
|
316
|
+
### Text (default)
|
|
317
|
+
|
|
318
|
+
Human-readable output with colors and source code snippets:
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
tally check Dockerfile
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
```text
|
|
325
|
+
WARNING: StageNameCasing - https://docs.docker.com/go/dockerfile/rule/stage-name-casing/
|
|
326
|
+
Stage name 'Builder' should be lowercase
|
|
327
|
+
|
|
328
|
+
Dockerfile:2
|
|
329
|
+
────────────────────
|
|
330
|
+
1 │ FROM alpine
|
|
331
|
+
>>>2 │ FROM ubuntu AS Builder
|
|
332
|
+
3 │ RUN echo "hello"
|
|
333
|
+
────────────────────
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### JSON
|
|
337
|
+
|
|
338
|
+
Machine-readable format with summary statistics and scan metadata:
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
tally check --format json Dockerfile
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
The JSON output includes:
|
|
345
|
+
- `files`: Array of files with their violations
|
|
346
|
+
- `summary`: Aggregate statistics (total, errors, warnings, etc.)
|
|
347
|
+
- `files_scanned`: Total number of files scanned
|
|
348
|
+
- `rules_enabled`: Number of active rules (with `DefaultSeverity != "off"`)
|
|
349
|
+
|
|
350
|
+
```json
|
|
351
|
+
{
|
|
352
|
+
"files": [
|
|
353
|
+
{
|
|
354
|
+
"file": "Dockerfile",
|
|
355
|
+
"violations": [
|
|
356
|
+
{
|
|
357
|
+
"location": {
|
|
358
|
+
"file": "Dockerfile",
|
|
359
|
+
"start": { "line": 2, "column": 0 }
|
|
360
|
+
},
|
|
361
|
+
"rule": "StageNameCasing",
|
|
362
|
+
"message": "Stage name 'Builder' should be lowercase",
|
|
363
|
+
"severity": "warning",
|
|
364
|
+
"docUrl": "https://docs.docker.com/go/dockerfile/rule/stage-name-casing/"
|
|
365
|
+
}
|
|
366
|
+
]
|
|
367
|
+
}
|
|
368
|
+
],
|
|
369
|
+
"summary": {
|
|
370
|
+
"total": 1,
|
|
371
|
+
"errors": 0,
|
|
372
|
+
"warnings": 1,
|
|
373
|
+
"info": 0,
|
|
374
|
+
"style": 0,
|
|
375
|
+
"files": 1
|
|
376
|
+
},
|
|
377
|
+
"files_scanned": 1,
|
|
378
|
+
"rules_enabled": 7
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### SARIF
|
|
383
|
+
|
|
384
|
+
[Static Analysis Results Interchange Format](https://docs.oasis-open.org/sarif/sarif/v2.1.0/) for CI/CD integration with GitHub Code Scanning, Azure DevOps, and other tools:
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
tally check --format sarif Dockerfile > results.sarif
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### GitHub Actions
|
|
391
|
+
|
|
392
|
+
Native GitHub Actions workflow command format for inline annotations:
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
tally check --format github-actions Dockerfile
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
```text
|
|
399
|
+
::warning file=Dockerfile,line=2,title=StageNameCasing::Stage name 'Builder' should be lowercase
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### Markdown
|
|
403
|
+
|
|
404
|
+
Concise Markdown tables optimized for AI agents and token efficiency:
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
tally check --format markdown Dockerfile
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
```markdown
|
|
411
|
+
**2 issues** in `Dockerfile`
|
|
412
|
+
|
|
413
|
+
| Line | Issue |
|
|
414
|
+
|------|-------|
|
|
415
|
+
| 10 | ❌ Use absolute WORKDIR |
|
|
416
|
+
| 2 | ⚠️ Stage name 'Builder' should be lowercase |
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
Features:
|
|
420
|
+
|
|
421
|
+
- Summary upfront with issue counts
|
|
422
|
+
- Sorted by severity (errors first)
|
|
423
|
+
- Emoji indicators: ❌ error, ⚠️ warning, ℹ️ info, 💅 style
|
|
424
|
+
- No rule codes or doc URLs (token-efficient)
|
|
425
|
+
- Multi-file support with File column when needed
|
|
426
|
+
|
|
427
|
+
### Output Options
|
|
428
|
+
|
|
429
|
+
| Flag | Description |
|
|
430
|
+
| --------------- | ------------------------------------------------------------------ |
|
|
431
|
+
| `--format, -f` | Output format: `text`, `json`, `sarif`, `github-actions`, `markdown` |
|
|
432
|
+
| `--output, -o` | Output destination: `stdout`, `stderr`, or file path |
|
|
433
|
+
| `--no-color` | Disable colored output (also respects `NO_COLOR` env var) |
|
|
434
|
+
| `--show-source` | Show source code snippets (default: true) |
|
|
435
|
+
| `--hide-source` | Hide source code snippets |
|
|
436
|
+
|
|
437
|
+
### Exit Codes
|
|
438
|
+
|
|
439
|
+
| Code | Meaning |
|
|
440
|
+
| ---- | ------------------------------------------------- |
|
|
441
|
+
| `0` | No violations (or below `--fail-level` threshold) |
|
|
442
|
+
| `1` | Violations found at or above `--fail-level` |
|
|
443
|
+
| `2` | Parse or configuration error |
|
|
444
|
+
|
|
445
|
+
### Fail Level
|
|
446
|
+
|
|
447
|
+
Control which severity levels cause a non-zero exit code:
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
# Fail only on errors (ignore warnings)
|
|
451
|
+
tally check --fail-level error Dockerfile
|
|
452
|
+
|
|
453
|
+
# Never fail (useful for CI reporting without blocking)
|
|
454
|
+
tally check --fail-level none --format sarif Dockerfile > results.sarif
|
|
455
|
+
|
|
456
|
+
# Fail on any violation including style issues (default behavior)
|
|
457
|
+
tally check --fail-level style Dockerfile
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
Available levels (from most to least severe): `error`, `warning`, `info`, `style` (default), `none`
|
|
461
|
+
|
|
462
|
+
## Development
|
|
463
|
+
|
|
464
|
+
### Running Tests
|
|
465
|
+
|
|
466
|
+
```bash
|
|
467
|
+
# Run all tests
|
|
468
|
+
make test
|
|
469
|
+
|
|
470
|
+
# Run linting
|
|
471
|
+
make lint
|
|
472
|
+
|
|
473
|
+
# Run copy/paste detection (CPD)
|
|
474
|
+
make cpd
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
### Code Quality
|
|
478
|
+
|
|
479
|
+
This project uses:
|
|
480
|
+
|
|
481
|
+
- **golangci-lint** for Go linting
|
|
482
|
+
- **PMD CPD** for copy/paste detection (minimum 100 tokens)
|
|
483
|
+
|
|
484
|
+
Copy/paste detection runs automatically in CI and helps identify duplicate code patterns.
|
|
485
|
+
|
|
486
|
+
## Contributing
|
|
487
|
+
|
|
488
|
+
See [CLAUDE.md](CLAUDE.md) for development guidelines.
|
|
489
|
+
|
|
490
|
+
## License
|
|
491
|
+
|
|
492
|
+
Apache-2.0
|
package/bin/tally
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contino/tally-linux-x64",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The Linux 64-bit binary for tally",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/tinovyatkin/tally.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/tinovyatkin/tally/issues"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/tinovyatkin/tally#readme",
|
|
14
|
+
"os": [
|
|
15
|
+
"linux"
|
|
16
|
+
],
|
|
17
|
+
"cpu": [
|
|
18
|
+
"x64"
|
|
19
|
+
]
|
|
20
|
+
}
|