ci: linting
This commit is contained in:
30
.github/workflows/lint.yml
vendored
Normal file
30
.github/workflows/lint.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
name: Basic Linting
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: ["**"]
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
# - uses: asdf-vm/actions/setup@v3
|
||||||
|
# - name: Install tooling required for pre-commit
|
||||||
|
# run: |
|
||||||
|
# for tool in actionlint shellcheck terraform terraform-docs tflint ; do
|
||||||
|
# asdf plugin add "${tool}"
|
||||||
|
# asdf install "${tool}"
|
||||||
|
# done
|
||||||
|
# moving actionlint to centralized composite action
|
||||||
|
- uses: camunda/infra-global-github-actions/actionlint@main
|
||||||
|
with:
|
||||||
|
version: '1.7.4'
|
||||||
|
|
||||||
|
- uses: pre-commit/action@v3.0.1
|
||||||
|
with:
|
||||||
|
extra_args: --all-files --verbose
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,2 @@
|
|||||||
*.3mf
|
*.3mf
|
||||||
*.stl
|
*.stl
|
||||||
|
|||||||
39
.pre-commit-config.yaml
Normal file
39
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v5.0.0
|
||||||
|
hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: check-added-large-files
|
||||||
|
args:
|
||||||
|
- --maxkb=1000
|
||||||
|
- repo: https://github.com/detailyang/pre-commit-shell
|
||||||
|
rev: v1.0.6
|
||||||
|
hooks:
|
||||||
|
- id: shell-lint
|
||||||
|
args: [--external-sources]
|
||||||
|
- repo: https://github.com/adrienverge/yamllint
|
||||||
|
rev: v1.37.0
|
||||||
|
hooks:
|
||||||
|
- id: yamllint
|
||||||
|
args: ['-c', '.lint/yamllint/.yamllint']
|
||||||
|
- repo: https://github.com/rhysd/actionlint
|
||||||
|
rev: v1.7.7
|
||||||
|
hooks:
|
||||||
|
- id: actionlint
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 25.1.0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"--line-length=121"
|
||||||
|
]
|
||||||
|
- repo: https://github.com/renovatebot/pre-commit-hooks
|
||||||
|
rev: 39.227.1
|
||||||
|
hooks:
|
||||||
|
- id: renovate-config-validator
|
||||||
|
args: ["--strict"]
|
||||||
|
language_version: 20.18.0 # workaround till https://github.com/renovatebot/pre-commit-hooks/issues/2460 is fixed
|
||||||
|
...
|
||||||
1
.tool-versions
Normal file
1
.tool-versions
Normal file
@@ -0,0 +1 @@
|
|||||||
|
pre-commit 4.2.0
|
||||||
24
Makefile
Normal file
24
Makefile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
.PHONY: help
|
||||||
|
|
||||||
|
help:
|
||||||
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := help
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: asdf-plugins
|
||||||
|
asdf-plugins: ## Install asdf plugins
|
||||||
|
#
|
||||||
|
# Add plugins from .tool-versions file within the repo.
|
||||||
|
@# If the plugin is already installed asdf exits with 2, so grep is used to handle that.
|
||||||
|
@for plugin in $$(awk '{print $$1}' .tool-versions); do \
|
||||||
|
asdf plugin add $${plugin} 2>&1 | (grep "already added" && exit 0); \
|
||||||
|
done
|
||||||
|
# Update all plugins to their latest version
|
||||||
|
@asdf plugin update --all
|
||||||
|
|
||||||
|
.PHONY: asdf-install
|
||||||
|
asdf-install: asdf-plugins ## Install tools with asdf
|
||||||
|
#
|
||||||
|
# Install tools via asdf.
|
||||||
|
@asdf install
|
||||||
@@ -7,4 +7,4 @@ This is my first [OpenSCAD](https://openscad.org/) project to get a grip on it.
|
|||||||
|
|
||||||
Here are some customization examples:
|
Here are some customization examples:
|
||||||

|

|
||||||

|

|
||||||
|
|||||||
@@ -9,12 +9,12 @@ autosize=true;
|
|||||||
// rack size in inches. If autosize is true, this value will be ignored. Only 10 and 19 inch racks are supported.
|
// rack size in inches. If autosize is true, this value will be ignored. Only 10 and 19 inch racks are supported.
|
||||||
rack_size=10; // [10:10 inch,19:19 inch]
|
rack_size=10; // [10:10 inch,19:19 inch]
|
||||||
|
|
||||||
// Width of the device in mm. Will determine the width of the rackmount ears depending on rack_size.
|
// Width of the device in mm. Will determine the width of the rackmount ears depending on rack_size.
|
||||||
device_width=201;
|
device_width=201;
|
||||||
// Height of the device in mm. Will determine the height of the rackmount ear in standard HeightUnits (1HU=44.5 mm). The program will always choose the minimum number of units to fit the device height. Minimum is 1 unit.
|
// Height of the device in mm. Will determine the height of the rackmount ear in standard HeightUnits (1HU=44.5 mm). The program will always choose the minimum number of units to fit the device height. Minimum is 1 unit.
|
||||||
device_height=40;
|
device_height=40;
|
||||||
// Thickness of the rackmount ear.
|
// Thickness of the rackmount ear.
|
||||||
strength=3;
|
strength=3;
|
||||||
|
|
||||||
/* [Device Bores] */
|
/* [Device Bores] */
|
||||||
// Distance (in mm) of the device's front bores(s) to the front of the device
|
// Distance (in mm) of the device's front bores(s) to the front of the device
|
||||||
@@ -70,9 +70,9 @@ echo("Height: ", RACK_HEIGHT);
|
|||||||
echo("Rack Bore Count: ", RACK_BORE_COUNT);
|
echo("Rack Bore Count: ", RACK_BORE_COUNT);
|
||||||
|
|
||||||
// Calculate the width of the ear
|
// Calculate the width of the ear
|
||||||
function get_ear_width(device_width) =
|
function get_ear_width(device_width) =
|
||||||
device_width > RACK_WIDTH_10_INCH_INNER || autosize == false && rack_size == 19 ?
|
device_width > RACK_WIDTH_10_INCH_INNER || autosize == false && rack_size == 19 ?
|
||||||
(RACK_WIDTH_19_INCH - device_width) / 2 :
|
(RACK_WIDTH_19_INCH - device_width) / 2 :
|
||||||
(RACK_WIDTH_10_INCH_OUTER - device_width) / 2
|
(RACK_WIDTH_10_INCH_OUTER - device_width) / 2
|
||||||
;
|
;
|
||||||
rack_ear_width = get_ear_width(device_width);
|
rack_ear_width = get_ear_width(device_width);
|
||||||
@@ -83,8 +83,8 @@ function get_bore_depth(device_bore_margin_horizontal,device_bore_columns) =
|
|||||||
// Calculate the depth of the ear
|
// Calculate the depth of the ear
|
||||||
depth=device_bore_distance_front*2+get_bore_depth(device_bore_margin_horizontal,device_bore_columns);
|
depth=device_bore_distance_front*2+get_bore_depth(device_bore_margin_horizontal,device_bore_columns);
|
||||||
device_screw_alignment_vertical=
|
device_screw_alignment_vertical=
|
||||||
center_device_bore_alignment ?
|
center_device_bore_alignment ?
|
||||||
RACK_HEIGHT / 2 :
|
RACK_HEIGHT / 2 :
|
||||||
device_bore_margin_vertical / 2 + device_bore_distance_bottom
|
device_bore_margin_vertical / 2 + device_bore_distance_bottom
|
||||||
;
|
;
|
||||||
device_screw_alignment = [strength,depth/2,device_screw_alignment_vertical];
|
device_screw_alignment = [strength,depth/2,device_screw_alignment_vertical];
|
||||||
@@ -99,8 +99,8 @@ module base_ear(width,strength,height) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module screws_countersunk(length, diameter_head, length_head, diameter_shaft) {
|
module screws_countersunk(length, diameter_head, length_head, diameter_shaft) {
|
||||||
translate(device_screw_alignment)
|
translate(device_screw_alignment)
|
||||||
yrot(-90)
|
yrot(-90)
|
||||||
grid_copies(spacing=[device_bore_margin_vertical,device_bore_margin_horizontal],n=[device_bore_rows, device_bore_columns])
|
grid_copies(spacing=[device_bore_margin_vertical,device_bore_margin_horizontal],n=[device_bore_rows, device_bore_columns])
|
||||||
union() {
|
union() {
|
||||||
cylinder(h=length_head, r1=diameter_head/2, r2=diameter_shaft/2);
|
cylinder(h=length_head, r1=diameter_head/2, r2=diameter_shaft/2);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
customManagers: [
|
customManagers: [
|
||||||
// for asdf-vm.org tool versions
|
// for asdf-vm.org tool versions
|
||||||
{
|
{
|
||||||
@@ -54,4 +54,4 @@
|
|||||||
versioningTemplate: "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}",
|
versioningTemplate: "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user