Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add warning for mixed casing in FROM and AS keywords #419

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FortiShield
Copy link

This PR adds a warning for the FromAsCasing rule, addressing the issue of inconsistent casing between the FROM and AS keywords in Dockerfiles. The rule enforces consistent casing for readability and maintainability, providing a warning message when mixed casing occurs.

Changes:

  • Added a warning message:
    WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line X)

Examples:

Bad: FROM is uppercase, AS is lowercase. FROM debian:latest as builder

✅ Good: FROM and AS are both uppercase.
FROM debian:latest AS deb-builder

✅ Good: FROM and AS are both lowercase.
from debian:latest as deb-builder

For more information, refer to the Dockerfile checks documentation: [Dockerfile FROM-AS Casing](https://docs.docker.com/reference/build-checks/from-as-casing/

This PR adds a warning for the `FromAsCasing` rule, addressing the issue of inconsistent casing between the `FROM` and `AS` keywords in Dockerfiles. The rule enforces consistent casing for readability and maintainability, providing a warning message when mixed casing occurs.

### Changes:

- Added a warning message:  
  `WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line X)`

### Examples:

❌ **Bad:** `FROM` is uppercase, `AS` is lowercase.  
`FROM debian:latest as builder`

✅ Good: FROM and AS are both uppercase.
`FROM debian:latest AS deb-builder`

✅ Good: FROM and AS are both lowercase.
`from debian:latest as deb-builder`

For more information, refer to the Dockerfile checks documentation:
[Dockerfile FROM-AS Casing](https://docs.docker.com/reference/build-checks/from-as-casing/
@FortiShield FortiShield requested a review from a team as a code owner October 13, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant