justintime50-styles 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.
@@ -0,0 +1,18 @@
1
+ name: build
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ lint:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - name: Checkout Repository
10
+ uses: actions/checkout@v3
11
+ - name: Setup Node
12
+ uses: actions/setup-node@v3
13
+ with:
14
+ node-version: '18'
15
+ - name: Install dependencies
16
+ run: npm install
17
+ - name: Run lint
18
+ run: npm run format-check
@@ -0,0 +1,24 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout Repository
13
+ uses: actions/checkout@v3
14
+ - name: Setup Node
15
+ uses: actions/setup-node@v3
16
+ with:
17
+ node-version: '18'
18
+ registry-url: 'https://registry.npmjs.org'
19
+ - name: Install dependencies
20
+ run: npm install
21
+ - name: Publish to NPM
22
+ run: npm publish
23
+ env:
24
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # CHANGELOG
2
+
3
+ ## v0.1.0 (2022-11-24)
4
+
5
+ - Initial release. Includes basic styles for CSS, Javascript, PHP, Python, Ruby, and Swift
6
+ - Released via NPM and Composer
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Justin Hammond
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,348 @@
1
+ # Styles
2
+
3
+ A collection of style guides and best practices used for my projects and teams.
4
+
5
+ [![Build](https://github.com/Justintime50/styles/workflows/build/badge.svg)](https://github.com/Justintime50/styles/actions)
6
+ [![Licence](https://img.shields.io/github/license/justintime50/styles)](LICENSE)
7
+
8
+ This document is fluid and many changes will be coming over the next few months as I collect more information to include here. By the time I'm finished, I'd love the final product to look something like: <https://codeguide.co/>
9
+
10
+ ## Tooling Configuration
11
+
12
+ You can find various configuration files for styling/formatting tools across various langauges found in the `styles` directory.
13
+
14
+ ### NPM Install
15
+
16
+ Add `"justintime50-styles": "^0.1.0"` to `devDependencies` in `package.json`.
17
+
18
+ ### Composer Install
19
+
20
+ Add `"justintime50/styles": "^0.1.0"` to `require-dev` in `composer.json`.
21
+
22
+ ## General
23
+
24
+ ### Architecture
25
+
26
+ - Simple Design:
27
+ - Runs all the tests
28
+ - Contains no duplication
29
+ - Expresses the intent of the programmer
30
+ - Minimizes the number of classes and methods
31
+ - Build out clean interfaces over ad-hoc scripts or SQL queries. This will ensure consistency, safety, and it can be code reviewed
32
+ - Separate constructing a system from using it, meaning that the “setup” code should be separate from the main business logic
33
+ - Abstract your data structures. Abstract interfaces allow its users to manipulate the essence of the data without having to know how it’s implemented
34
+ - One example is a “vehicle fuel tank” interface where we expose the fuel tank capacity and number of gallons of gas variables. The better approach is to simply expose the percentage of fuel remaining (high level abstraction) so that if necessary we can change the implementation under the hood whenever we want
35
+ - Objects expose behavior and hide data. Data structures expose data and have no significant behavior
36
+ - When creating software, assume you are creating it for someone else to use. Allow for configuration, use CLI flags/env vars where possible, document how to use your tool, use simple interfaces, and build it so that anyone can use it and not just you and your one use-case
37
+ - Keep internal variables private, that way you can change their type of implementation on a whim. Make stable, consistent interfaces where users can then plug into. Every variable doesn’t need a getter and setter
38
+ - Use the Model, View, Controller framework (MVC), especially for frontend websites
39
+ - Use the Singleton design pattern when possible
40
+ - Routes -> Views/Actions -> Service -> Repo -> DB
41
+ - Use frontend and backend validation, this is important because when you have both, we can skip sending an API call for instance when we know there is bad data. We will then only send the payload across once the data is valid. Backend validation is important as the source of truth and because things like developer tools in a browser can defeat frontend validations
42
+
43
+ ### Checklist
44
+
45
+ - Ensure the code you are writing is `NULL` safe
46
+ - Ensure the code you are writing either has a unit test (especially when you need to guard against a regression) or that you have end-to-end tested it. Preferably, you would accomplish both
47
+ - Ensure the code is readable, remember, you will have other contributors looking at this in the future, maybe even years later
48
+ - Will it make sense then as it does now?
49
+ - Ensure your code is easily to maintain. Can things be added to this easily, can we tweak the configuration if requirements change in the future, does it make sense enough that someone with no context could jump in down the road and work on this?
50
+ - Ensure your code preserves git blame (eg: Trailing commas, breaking up lists to different lines)
51
+ - Ensure your code is self documenting (eg: function and variable names give a clear indicator to the reader of what is happening and what it is doing)
52
+ - Ensure your code does not introduce side effects. Functions and classes should do one thing without bleeding into other areas
53
+
54
+ ### Classes
55
+
56
+ - Class variables should be listed public static constants first, then private static variables, followed by private instance variables. There is seldom reason to have a public variable
57
+ - The name of a class should describe what responsibilities it fulfills
58
+ - You should be able to define a class in 25 words or less without using the words “if”, “and”, “or”, or “but”, otherwise it probably has too many responsibilities
59
+ - SPR: Single Responsibility Principle, classes should only ever do one thing. A “dashboard” class shouldn’t grab the version number and show stats for your app
60
+ - Break out the version data into a separate class
61
+ - Programs should be made up of many small classes
62
+ - OCP: Open-Closed Principle, classes are open to extension but closed to modification
63
+ - DIP: Dependency Inversion Principle, classes should depend on abstractions, not concrete details
64
+ - Using instance variables is a powerful way to cut down on passing large amounts of parameters around your app when everything is stored within the `self` namespace, it can be easily referenced from any instance method and seemingly numberless variables can be associated with `self` (eg: Python)
65
+
66
+ ### Comments
67
+
68
+ - Comments should be used when we fail to express properly our intentions in code
69
+ - Comments should explain why we did what we did
70
+ - Comments can live for years, make sure they’ll age well hundreds of commits later
71
+
72
+ ### Concurrency
73
+
74
+ - Keep your concurrency related code separate from other code
75
+ - Limit the access of any data that may be shared across threads
76
+ - Make copies of the data used in threads, try not to edit data in threads as it can lead to deadlock and sync issues
77
+ - Keep threads as independent as possible
78
+ - Avoid using more than one method on a shared object
79
+ - Keep your synchronized sections as small as possible
80
+ - Shutting down a system gracefully is hard. Start planning this piece of the concurrent puzzle early
81
+ - Don’t ignore one-off failures in concurrency, typically it is an indicator your system isn’t built well
82
+ - Make thread based code “pluggable”, where the logic and the threading happen separately and can be easily configured
83
+
84
+ ### Databases
85
+
86
+ - All inserts/updates must be run inside a transaction. Validate your change before committing it.
87
+
88
+ ### Error Handling
89
+
90
+ - Extract try/catch block bodies into their own functions so that error processing can be separated from normal logic
91
+ - Error handling should be in its own function if we are following the “functions do one thing” rule
92
+ - If error handling obscures logic, it’s wrong
93
+
94
+ ### Functions
95
+
96
+ - Have a single return statement (don’t return early)
97
+ - Return statements should have a line break betwen them and the content above to clearly define the function is now complete and to separate focuses
98
+ - Avoid returning null, avoid passing null as a parameter
99
+ - Avoid using class methods where possible and instead use instance or static methods.
100
+ - Don’t use “selector arguments” or booleans for arguments to a function because this breaks the single responsibility principle. If your function does something different depending on a Boolean parameter, it really does two things and therefore the name will be misleading. Instead, you should break up the function into smaller functions, each doing one branch of the boolean flag
101
+
102
+ #### Proper Function Structure
103
+
104
+ Functions should follow the 1-2-3 principle:
105
+
106
+ 1. The first grouping of code (split by an empty newline) is usually boilerplate code or setup where we assign variables that we'll need later on
107
+ 2. The second grouping of code (split by an empty newline) is the logic where we actually do what the function is called
108
+ 3. The third grouping (split by an empty newline) should be the final return statement. Functions should also only return once at the end for easy maintenance and readability (TODO: provide research into this)
109
+
110
+ There are obviously larger and smaller functions than this, but don't be afraid of newlines in functions. I've seen countless 30 line functions that had no line breaks which can be very hard on the eyes when scanning or reasoning about code. Breaking up related blocks of code makes maintaining and reading that code much easier.
111
+
112
+ ```python
113
+ def is_number_large(my_number, threshold = 100):
114
+ """Returns true if a number is larger than a custom threshold."""
115
+ number_as_int = int(my_number)
116
+ threshold_as_int = int(threshold)
117
+
118
+ if number_as_int > threshold_as_int:
119
+ large_number = True
120
+ else:
121
+ large_number = False
122
+
123
+ return large_number
124
+ ```
125
+
126
+ ### Meta
127
+
128
+ - Put all instance variables at the top of your file, don’t mix them with public functions
129
+ - “Main” functions should be declared first in a file so that you can then keep reading from top to bottom as you drill down
130
+ - Files shouldn’t exceed 200 lines of code
131
+ - Line lengths should not exceed 120 chars
132
+ - Use trailing commas where possible so that the list can easily grow in the future while keeping the next diff small
133
+ - Create a consistent lexicon and share it across the company for things like names (eg: fetch, get, retrieve all ultimately mean the same thing, which will you use across your code base?). If you do something someway, do it that way everywhere. This leans back to the principle of least surprise
134
+ - Don’t pack lists or block pack them, always unpack lists so that each item is on its own line. It’s easier to read vertically than it is horizontally
135
+ - Use object literals over complex if/else or switch/case statements
136
+ - Use implicit true statements when possible (eg: `if im_awesome is True:` — vs — `if im_awesome:`)
137
+ - When making string comparisons, lowercase/uppercase and strip the whitespace on the strings you are comparing
138
+ - Always sort your lists unless there is an explicit reason not to. This ensures that diffs stay small and sorted lists are much easier to maintain and find info in
139
+ - Positives are easier to understand than negatives, in the case of if/else statements, have the “if” section be the positive logic
140
+ - Don’t include dead code. This could be code in an if/else block that will never be reached or code in a try/except block that can never throw
141
+ - Think of “vertical separation”, variables and functions should be defined close to where they are used, not hundreds of lines apart
142
+ - General purpose static functions should not be contained in a class since they typically aren’t actually coupled to the class
143
+ - Shoot for brevity, be precise! Don’t use a float for currency (break it down into an integer for "cents"), don’t avoid adding lock/transaction management on concurrency, etc - “Don’t be lazy about the precision of your decision”
144
+ - Avoid words like `filter` when naming thnigs because it can either mean `filter out` or `filter in`
145
+
146
+ ### Naming
147
+
148
+ - Don’t try to be smart, spell things out (eg: variable and function names)
149
+ - Abbreviating or coming up with clever names only leads to more taxing code scanning by the next engineer
150
+ - Use constants or variables to define integers and other strings that aren’t easily identifiable (vs just passing them inline as parameters without declaring what they are). A great example of a snippet of code where this could be useful is instead of directly returning the following, you could assign it a descriptive variable and return that clean variable instead: `{k: cls._objects_to_ids(v) for k, v in six.iteritems(params)}`. This also goes for having multiple and/or statements, assign them to a variable to help describe intent
151
+
152
+ ### Open Source
153
+
154
+ - Projects should be placed in a top-level `src` folder so that project config and documents can live outside the project folder
155
+ - Target versions of a language back to the the oldest maintained version up through the newest version where possible. Drop support for versions of a language that no longer receive maintenance (security updates, etc) and adopt new versions as early as is feasible
156
+
157
+ ### Testing
158
+
159
+ - Clean tests follow five rules:
160
+ - Fast: tests must be fast, otherwise you will stop running them and code will rot
161
+ - Independent: tests should not need to run in a specific order. They should not setup conditions for another test
162
+ - Repeatable: tests should be repeatable in any environment and produce the same output each time
163
+ - Self-validating: tests should be pass/fail, you shouldn’t need to inspect logs or compare files to see if a test passed
164
+ - Timely: tests should be written shortly before the production code they’ll be testing
165
+ - Unit tests should follow the Build-Operate-Check model where test data is built, then the function is operated, and finally the result is asserted against an expectation. Don’t add extra noise to tests
166
+ - Test only a single concept per unit test
167
+ - Don’t mock to make yourself feel better; mock because you have to
168
+
169
+ ## Language Specific
170
+
171
+ ### CSharp
172
+
173
+ #### Tools
174
+
175
+ - **Linter:** [Dotnet format](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-format)
176
+ - **VCR:** [EasyVCR](https://github.com/EasyPost/easyvcr-csharp)
177
+
178
+ ### CSS
179
+
180
+ #### CSS Tools
181
+
182
+ - **Linter:** [stylelint](https://github.com/stylelint/stylelint)
183
+
184
+ #### CSS Styles
185
+
186
+ The following is a checklist of items that every website should have:
187
+
188
+ - Site must use a `fallback font` for every font used
189
+
190
+ ### Docker
191
+
192
+ #### Docker Tools
193
+
194
+ - **Linter:** [Hadolint](https://github.com/hadolint/hadolint)
195
+
196
+ ### Golang
197
+
198
+ #### Golang Tools
199
+
200
+ - **Formatter:** [Gofmt](https://pkg.go.dev/cmd/gofmt)
201
+ - **Linter:** [Golangci-lint](https://golangci-lint.run)
202
+ - **Security:** [Gosec](https://github.com/securego/gosec)
203
+ - **VCR:** [go-vcr](https://github.com/dnaeon/go-vcr)
204
+
205
+ ### HTML
206
+
207
+ #### HTML Tools
208
+
209
+ - **Linter:** [HTMLHint](https://github.com/htmlhint/HTMLHint)
210
+
211
+ #### HTML Styles
212
+
213
+ - Don't repeat `&nbsp;` over and over when you want to space something, use a CSS class in a `<span>` to do this instead
214
+ - Avoid using inline CSS styles (use CSS classes and external stylesheets)
215
+ - `<br />` tags should only be contained inside a set of `<p>` tags. CSS classes should lbe used otherwise to provide vertical spacing
216
+ - Always list the `href/src` first for stylesheets and scripts for easy readability and visual scanning (eg: `<a href="https://example.com" target="_blank">example</a>`)
217
+ - `rel` is required for stylesheets
218
+
219
+ The following is a checklist of items that every website should have:
220
+
221
+ - Site must have a Favicon
222
+ - Site must show a well-formed `404 Page` when users visit a page that does not exist
223
+ - Site must appropriately handle other `4xx` and `5xx` pages
224
+ - Site must have `Google Analytics` or another method of analytics
225
+ - Site must use modularized pages (eg: nav/footer are their own components and can be reused)
226
+ - Site must have a `meta author tag`
227
+ - Site must have a `meta keyword tag` containing no duplicates
228
+ - Site must have a `meta description tag`
229
+ - Site must define a `language` in the `html` tag
230
+ - Site must define a `meta character set` (eg: UTF-8)
231
+ - Site must define a `robots.txt` file that whitelists all public pages (can use wildcard), and explicitly blacklist pages that should not be accessible
232
+ - Site must define `alt & title tags` on every image
233
+ - Site must have a publicly available `Sitemap`
234
+
235
+ ### Java
236
+
237
+ #### Java Tools
238
+
239
+ - **Linter:** [Checkstyle](https://github.com/checkstyle/checkstyle)
240
+ - **Static Analysis:** [Error Prone](https://github.com/google/error-prone)
241
+ - **VCR:** [EasyVCR](https://github.com/EasyPost/easyvcr-java)
242
+
243
+ ### Javascript
244
+
245
+ #### Javascript Tools
246
+
247
+ - **Formatter:** [Prettier](https://prettier.io)
248
+ - Config file found in this repo: `.prettierrc.yml`
249
+ - **Linter:** [ESLint](https://github.com/eslint/eslint)
250
+ - Config file found in this repo: `.eslintrc.yml`
251
+ - **Tests:** [Mocha](https://github.com/mochajs/mocha)
252
+ - **VCR:** [Polly.js](https://github.com/Netflix/pollyjs)
253
+
254
+ ### PHP
255
+
256
+ #### PHP Tools
257
+
258
+ - **Linter:** [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)
259
+ - **Tests:** [PHPUnit](https://github.com/sebastianbergmann/phpunit)
260
+ - **VCR:** [PHP VCR](https://github.com/php-vcr/php-vcr)
261
+
262
+ ### Python
263
+
264
+ #### Python Tools
265
+
266
+ - **Formatter:** [Black](https://github.com/psf/black)
267
+ - Config file found in this repo: `pyproject.toml`
268
+ - **Import Sorter:** [iSort](https://github.com/PyCQA/isort)
269
+ - **Linter:** [Flake8](https://github.com/PyCQA/flake8)
270
+ - Config file found in this repo: `.flake8`
271
+ - **Security:** [Bandit](https://github.com/PyCQA/bandit)
272
+ - **Static Analysis:** [mypy](https://github.com/python/mypy)
273
+ - **Tests:** [Pytest](https://github.com/pytest-dev/pytest)
274
+ - **VCR:** [VCR.py](https://github.com/kevin1024/vcrpy)
275
+
276
+ #### Python Styles
277
+
278
+ - You can’t kill threads easily in Python, keep this in mind when playing with concurrency
279
+ - Do not define raw paths, you must use the `os.path.join()` function as this will automatically build the paths for you depending on what OS you're on (eg: slashes on Windows)
280
+ - Use `datetime.timedelta` to offset a date which will automatically roll over months and years as needed. Do not add `+6` to a date or year as you will run into an error such as a month not being able to contain 35 days
281
+ - It's generally an anti-pattern to do something like the following. If a file got deleted between the check and it being removed, it will error.
282
+ - "Mock an item where it is used, not where it came from."
283
+
284
+ ```python
285
+ # Anti-pattern
286
+ if os.path.isfile(file_path):
287
+ os.remove(file_path)
288
+
289
+ # Use instead
290
+ try:
291
+ os.remove(file_path)
292
+ except FileNotFoundError:
293
+ pass
294
+ ```
295
+
296
+ - Ensure that error assertions are unindented from a pytest context helper (bites me all the time):
297
+
298
+ ```python
299
+ # This will fail
300
+ with pytest.raises(Error) as error:
301
+ my_function('BAD_INPUT')
302
+
303
+ assert str(error.value) == 'You sent bad input'
304
+
305
+ # This will succeed
306
+ with pytest.raises(Error) as error:
307
+ my_function('BAD_INPUT')
308
+
309
+ assert str(error.value) == 'You sent bad input'
310
+ ```
311
+
312
+ ### Ruby
313
+
314
+ #### Ruby Tools
315
+
316
+ - **Linter:** [RuboCop](https://github.com/rubocop-hq/rubocop)
317
+ - **Security:** [Brakeman](https://github.com/presidentbeef/brakeman)
318
+ - **Tests:** [RSpec](https://github.com/rspec/rspec)
319
+
320
+ ### Shell (Bash)
321
+
322
+ #### Shell Tools
323
+
324
+ - **Linter:** [ShellCheck](https://github.com/koalaman/shellcheck)
325
+
326
+ #### Shell Styles
327
+
328
+ - Build shell scripts and tools for the largest compatible surface area possible, ensure they are POSIX compliant and able to not only run on the latest versions of Bash but also the oldest versions of `sh`, `dash`, or `ksh`
329
+
330
+ ### Swift
331
+
332
+ #### Swift Tools
333
+
334
+ - **Linter:** [Swiftlint](https://github.com/realm/SwiftLint)
335
+
336
+ ### Websites & Infrastructure
337
+
338
+ #### Websites & Infrastructure Styles
339
+
340
+ - Site must have a `www.` alias configured
341
+ - Site must have `SSL` configured (eg: LetsEncrypt)
342
+ - Site must pass an `SSL cert test` with an `A` or better rating
343
+ - Site must pass a `speed test` check
344
+ - Site must pass a `compatibility test` check
345
+ - Site must have minified HTML, CSS, and JS where possible
346
+ - Databases should be configured to have at least a single main read/write node and multiple read-only replicas. This helps with scaling and allows for failover when necessary. Applications should then only read from the replicas and write to the main node. Reporting and analytics can then be pulled from a dedicated replica so production data is not affected.
347
+ - Services should be load balanced to at least 2 instances for each "container", providing high availability when one or more nodes fail
348
+ - Services should have a healthcheck, be killed upon failure, and automatically restarted when those healthchecks fail for automated recovery
package/composer.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "justintime50/styles",
3
+ "description": "A collection of style guides and best practices used for my projects and teams.",
4
+ "version": "0.1.0",
5
+ "license": "MIT",
6
+ "type": "library",
7
+ "homepage": "https://github.com/Justintime50/styles",
8
+ "authors": [
9
+ {
10
+ "name": "Justintime50",
11
+ "email": "39606064+Justintime50@users.noreply.github.com"
12
+ }
13
+ ],
14
+ "require": {}
15
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "justintime50-styles",
3
+ "description": "A collection of style guides and best practices used for my projects and teams.",
4
+ "version": "0.1.0",
5
+ "author": "Justintime50",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/justintime50/styles",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/justintime50/styles.git"
11
+ },
12
+ "devDependencies": {
13
+ "prettier": "^2.8.0"
14
+ },
15
+ "scripts": {
16
+ "format": "prettier --config src/javascript/.prettierrc.yaml --write .",
17
+ "format-check": "prettier --config src/javascript/.prettierrc.yaml --check ."
18
+ }
19
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "stylelint-config-standard"
3
+ }
@@ -0,0 +1,7 @@
1
+ env:
2
+ commonjs: true
3
+ es6: true
4
+ node: true
5
+ extends: 'eslint:recommended'
6
+ parserOptions:
7
+ ecmaVersion: 2022
@@ -0,0 +1,3 @@
1
+ trailingComma: 'es5'
2
+ singleQuote: true
3
+ printWidth: 120
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0"?>
2
+
3
+ <ruleset name="PHP_CodeSniffer">
4
+ <description>PHP CodeSniffer Ruleset by Justintime50</description>
5
+
6
+ <!-- Where to lint -->
7
+ <file>src</file>
8
+
9
+ <!-- What to exclude -->
10
+ <exclude-pattern>*/bin/*</exclude-pattern>
11
+ <exclude-pattern>*/vendor/*</exclude-pattern>
12
+ <exclude-pattern>*.blade.php</exclude-pattern>
13
+ <exclude-pattern>*/bootstrap/*</exclude-pattern>
14
+ <exclude-pattern>*/migrations/*</exclude-pattern>
15
+ <exclude-pattern>*/node_modules/*</exclude-pattern>
16
+ <exclude-pattern>*/storage/*</exclude-pattern>
17
+
18
+ <!-- Only lint PHP files -->
19
+ <arg name="extensions" value="php" />
20
+
21
+ <!-- Ignore warnings and display errors only -->
22
+ <arg value="np" />
23
+
24
+ <!-- Use the PSR12 ruleset -->
25
+ <rule ref="PSR12" />
26
+
27
+ <!-- Enforce custom rules -->
28
+ <rule ref="Generic.Arrays.DisallowLongArraySyntax" />
29
+ <rule ref="Squiz.NamingConventions.ValidVariableName.NotCamelCaps" />
30
+ <rule ref="Squiz.Strings.DoubleQuoteUsage.NotRequired" />
31
+ <rule ref="vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Commenting/InlineCommentSniff.php" />
32
+ </ruleset>
@@ -0,0 +1,3 @@
1
+ [flake8]
2
+ max-line-length = 120
3
+ extend-ignore = E203
@@ -0,0 +1,14 @@
1
+ [tool.black]
2
+ preview = true
3
+ line-length = 120
4
+
5
+ [tool.isort]
6
+ profile = "black"
7
+ line_length = 120
8
+ indent = 4
9
+ force_grid_wrap = 2
10
+ multi_line_output = 3
11
+ sections = "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"
12
+ lines_after_imports = 2
13
+ include_trailing_comma = true
14
+ use_parentheses = true
@@ -0,0 +1,3 @@
1
+ AllCops:
2
+ NewCops: disable
3
+ TargetRubyVersion: 2.6
@@ -0,0 +1,9 @@
1
+ excluded:
2
+ - .build
3
+
4
+ disabled_rules:
5
+ - todo
6
+ - file_length
7
+ - function_body_length
8
+ - type_body_length
9
+ - line_length