Skip to content

Commit

Permalink
Fix for lint errors (#1081)
Browse files Browse the repository at this point in the history
  • Loading branch information
sualeh authored Apr 13, 2023
1 parent 81c2c7c commit 9c398d1
Show file tree
Hide file tree
Showing 28 changed files with 387 additions and 306 deletions.
8 changes: 8 additions & 0 deletions .github/linters/.hadolint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ignored:
# Pin versions
- DL3008
- DL3018
- DL3013
- DL3016
- DL3028
no-color: true
3 changes: 1 addition & 2 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ MD004: false # Unordered list style
MD007: # Unordered list indentation
indent: 2
MD009: false # Trailing spaces
MD013:
line_length: 808 # Line length
MD013: false # Line length
MD026: # List of not allowed
punctuation: ".,;:!。,;:"
MD029: false # Ordered list item prefix
Expand Down
58 changes: 58 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'

ignore: |
.github/
**/target/
**/*bad-3*.yaml
rules:
anchors: enable
braces:
forbid: true
brackets:
forbid: false
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
colons:
max-spaces-before: 0
max-spaces-after: 1
commas: enable
comments:
require-starting-space: true
ignore-shebangs: true
min-spaces-from-content: 2
level: warning
comments-indentation:
level: warning
document-end: disable
document-start: disable
empty-lines:
max: 1
max-end: 1
empty-values: disable
float-values: disable
hyphens:
max-spaces-after: 1
indentation:
spaces: consistent
indent-sequences: consistent
# check-multi-line-strings: true
key-duplicates: enable
key-ordering: disable
line-length:
max: 200
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: false
new-line-at-end-of-file: disable
new-lines: disable
octal-values: disable
quoted-strings: disable
trailing-spaces: enable
truthy:
allowed-values: ['true', 'false']
level: warning
9 changes: 9 additions & 0 deletions .github/scripts/super-lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
docker run \
--rm \
-e RUN_LOCAL=true \
-e DEFAULT_BRANCH=lint \
-e FILTER_REGEX_EXCLUDE=".*\.git/.*" \
--env-file ".github/super-linter.env" \
--mount type=bind,source="$(pwd)",target=/tmp/lint \
github/super-linter
7 changes: 7 additions & 0 deletions .github/scripts/yamllint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
docker run \
--rm -it \
--mount type=bind,source="$(pwd)",target=/data \
cytopia/yamllint \
--config-file .github/linters/.yaml-lint.yml \
.
20 changes: 20 additions & 0 deletions .github/super-linter.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CREATE_LOG_FILE=true
SUPPRESS_POSSUM=true
LOG_LEVEL=NOTICE
ERROR_ON_MISSING_EXEC_BIT=false
IGNORE_GITIGNORED_FILES=true
VALIDATE_ALL_CODEBASE=true
VALIDATE_YAML=true
VALIDATE_JSON=true
VALIDATE_XML=true
VALIDATE_MARKDOWN=true
VALIDATE_BASH=true
# VALIDATE_GOOGLE_JAVA_FORMAT=true
# VALIDATE_PYTHON=false
# VALIDATE_RUBY=false
VALIDATE_JAVASCRIPT_ES=true
# VALIDATE_DOCKERFILE_HADOLINT=true
# VALIDATE_CSS=true
# VALIDATE_ENV=true
# VALIDATE_SQL=true
# HADOLINT_VERBOSE=1
23 changes: 6 additions & 17 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,15 @@ jobs:
fetch-depth: 0

# LINT CODE
- id: read-env
name: Use super-linter environmental variables
shell: bash
run: |
# Use super-linter environmental variables
cat .github/super-linter.env >> "$GITHUB_ENV"
- id: lint-code-base
name: Lint Code Base
uses: github/super-linter/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BRANCH: main
ERROR_ON_MISSING_EXEC_BIT: true
IGNORE_GITIGNORED_FILES: true
VALIDATE_ALL_CODEBASE: true
VALIDATE_YAML: true
VALIDATE_JSON: true
VALIDATE_XML: true
VALIDATE_MARKDOWN: true
VALIDATE_BASH: true
VALIDATE_GOOGLE_JAVA_FORMAT: true
VALIDATE_EDITORCONFIG: trues
# VALIDATE_PYTHON: false
# VALIDATE_RUBY: false
VALIDATE_JAVASCRIPT_ES: true
VALIDATE_DOCKERFILE_HADOLINT: true
# VALIDATE_CSS: true
# VALIDATE_ENV: true
# VALIDATE_SQL: true
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
coverage:
round: nearest
range: 75..90
ignore: # ignore folders and all their contents
ignore: # ignore folders and all their contents
- "schemacrawler-testdb"
- "schemacrawler-diff"
- "schemacrawler-examplecode"
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: catalog
alternate-keys:
- name: 1_alternate_key
catalog: PUBLIC
schema: BOOKS
table: BOOKAUTHORS
columns:
- BOOKID
- AUTHORID
remarks:
- "Indicate that this key is being used as a primary key"
- name: 1_alternate_key
catalog: PUBLIC
schema: BOOKS
table: BOOKAUTHORS
columns:
- BOOKID
- AUTHORID
remarks:
- "Indicate that this key is being used as a primary key"
2 changes: 1 addition & 1 deletion schemacrawler-docker-compose/db2.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: "3.7"

services:

Expand Down
2 changes: 1 addition & 1 deletion schemacrawler-docker-compose/oracle-11g.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ services:
- target: 1521
published: 1521
protocol: tcp
mode: host
mode: host
environment:
ORACLE_PASSWORD: test
2 changes: 1 addition & 1 deletion schemacrawler-docker-compose/oracle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ services:
- target: 1521
published: 1521
protocol: tcp
mode: host
mode: host
environment:
ORACLE_PASSWORD: test
10 changes: 5 additions & 5 deletions schemacrawler-docs/config/schemacrawler-linter-configs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
config:
message: Lint message A
sql: SELECT TOP 1 1 FROM ${table}
# The same linter can be configured multiple times with different options
# The same linter can be configured multiple times with different options
- id: schemacrawler.tools.linter.LinterTableSql
table-exclusion-pattern: .*BOOKS
config:
message: Lint message A
sql: SELECT TOP 1 2 FROM ${table}
# Linters can be turned off with the "run" option
- id: schemacrawler.tools.linter.LinterTableSql
# Linters can be turned off with the "run" option
run: false
config:
message: message D
Expand All @@ -18,11 +18,11 @@
config:
message: message for SQL catalog lint
sql: SELECT TOP 1 1 FROM INFORMATION_SCHEMA.TABLES
# All available linters run by default, so they need to be explicitly turned off
- id: schemacrawler.tools.linter.LinterForeignKeyMismatch
# All available linters run by default, so they need to be explicitly turned off
run: false
# You can oerride severity and threshold (numer of allowed failures)
- id: schemacrawler.tools.linter.LinterForeignKeyWithNoIndexes
# You can override severity and threshold (numer of allowed failures)
severity: critical
threshold: 0
- id: schemacrawler.tools.linter.LinterNullColumnsInIndex
Expand All @@ -37,9 +37,9 @@
run: false
- id: schemacrawler.tools.linter.LinterTableWithNoIndexes
run: false
# Certain columns can be excluded from the linter
- id: schemacrawler.tools.linter.LinterTableWithQuotedNames
run: true
# Certain columns can be excluded from the linter
column-exclusion-pattern: .*\.\"UPDATE\"
- id: schemacrawler.tools.linter.LinterTableWithSingleColumn
run: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Explore the AdventureWorks Database with SchemaCrawler

### Setup
## Setup

- Start SchemaCrawler with the AdventureWorks Database on Microsoft SQL Server
`docker-compose -f adventureworks.yaml up -d`
Expand Down Expand Up @@ -67,7 +67,7 @@



### Tear Down
## Tear Down

- Stop the SchemaCrawler and database Docker containers
`docker-compose -f schemacrawler.yml -f adventureworks.yml down -t0`
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
- id: schemacrawler.tools.linter.LinterTableWithPrimaryKeyNotFirst
run: true
severity: high
table-exclusion-pattern: .*\.([A-Z]{2,5}_PK) # .*\.(^[A-Z]{2,5}_DWH_)
table-exclusion-pattern: .*\.([A-Z]{2,5}_PK) # .*\.(^[A-Z]{2,5}_DWH_)
- id: schemacrawler.tools.linter.LinterTableWithSingleColumn
run: false
- id: schemacrawler.tools.linter.LinterForeignKeyMismatch
run: false
run: false
- id: schemacrawler.tools.linter.LinterForeignKeyWithNoIndexes
run: false
- id: schemacrawler.tools.linter.LinterNullColumnsInIndex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- id: schemacrawler.tools.linter.LinterTableWithSingleColumn
run: false
- id: schemacrawler.tools.linter.LinterForeignKeyMismatch
run: false
run: false
- id: schemacrawler.tools.linter.LinterForeignKeyWithNoIndexes
run: false
- id: schemacrawler.tools.linter.LinterNullColumnsInIndex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- id: "linter.Linter2"
severity: null
config:
sql: >
sql: >
SELECT
*
FROM
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- id: schemacrawler.tools.linter.LinterCatalogSql
# Read config from SchemaCrawler config file
# (Read LinterCatalogSql config from SchemaCrawler config file)
- id: schemacrawler.tools.linter.LinterTableWithSingleColumn
run: false
- id: schemacrawler.tools.linter.LinterForeignKeyMismatch
run: false
run: false
- id: schemacrawler.tools.linter.LinterForeignKeyWithNoIndexes
run: false
- id: schemacrawler.tools.linter.LinterNullColumnsInIndex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- id: schemacrawler.tools.linter.LinterTableWithSingleColumn
run: false
- id: schemacrawler.tools.linter.LinterForeignKeyMismatch
run: false
run: false
- id: schemacrawler.tools.linter.LinterForeignKeyWithNoIndexes
run: false
- id: schemacrawler.tools.linter.LinterNullColumnsInIndex
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
name: schemacrawler.test.SchemaCrawlerTest
alternate-keys:
# 1. Happy path - good alternate key
- name: 1_alternate_key
catalog: PUBLIC
schema: BOOKS
table: AUTHORS
columns:
- ID
remarks:
- "Overwritten remarks line 1"
attributes:
"some tag 1": tagvalue1
tag2: "tag value 2"
# 2. External table - not built
- name: 2_alternate_key
catalog: PUBLIC
schema: BOOKS
table: OTHERTABLE
columns:
- ID
# 3. External column - not built
- name: 3_alternate_key
catalog: PUBLIC
schema: BOOKS
table: AUTHORS
columns:
- OTHERCOLUMN
# 1. Happy path - good alternate key
- name: 1_alternate_key
catalog: PUBLIC
schema: BOOKS
table: AUTHORS
columns:
- ID
remarks:
- "Overwritten remarks line 1"
attributes:
"some tag 1": tagvalue1
tag2: "tag value 2"
# 2. External table - not built
- name: 2_alternate_key
catalog: PUBLIC
schema: BOOKS
table: OTHERTABLE
columns:
- ID
# 3. External column - not built
- name: 3_alternate_key
catalog: PUBLIC
schema: BOOKS
table: AUTHORS
columns:
- OTHERCOLUMN
Loading

0 comments on commit 9c398d1

Please sign in to comment.