Skip to content

Commit 8f62280

Browse files
authored
feat: Create linter action (#4)
* Create linter action * Update linter.yml * Markdown lint * Markdown lint * Markdown lint * Yaml lint * Remove font reference for now * Update linter.yml * Updated libraries * Rename steps * Update gradle wrapper * Ignore false positive * Added json linter * Test super linter * Update linter.yml * Update linter.yml * Update linter.yml * Update linter.yml * Update linter.yml * Update linter.yml * Added linter badge
1 parent 95cdae0 commit 8f62280

18 files changed

+701
-310
lines changed

.github/workflows/linter.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: Linting
3+
4+
on: # yamllint disable-line rule:truthy
5+
pull_request:
6+
branches:
7+
- develop
8+
- main
9+
10+
jobs:
11+
build:
12+
name: Linting
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
contents: read
17+
packages: read
18+
statuses: write
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Super-linter
27+
uses: super-linter/[email protected]
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
LINTER_RULES_PATH: /
31+
MARKDOWN_CONFIG_FILE: '.markdownlint.json'
32+
VALIDATE_CHECKOV: false
33+
VALIDATE_JSCPD: false
34+
VALIDATE_KOTLIN: false
35+
VALIDATE_JSON_PRETTIER: false
36+
VALIDATE_MARKDOWN_PRETTIER: false
37+
VALIDATE_YAML_PRETTIER: false
38+
39+
- name: Set up JDK
40+
uses: actions/[email protected]
41+
with:
42+
distribution: zulu
43+
java-version: 21
44+
cache: gradle
45+
- run: ./gradlew lint
46+
- name: Lint Foundation module
47+
uses: yutailang0119/action-android-lint@v4
48+
with:
49+
report-path: foundation/build/reports/*.xml
50+
- name: Lint Components module
51+
uses: yutailang0119/action-android-lint@v4
52+
with:
53+
report-path: components/build/reports/*.xml

.markdownlint.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"no-duplicate-heading": {
3+
"siblings_only": true
4+
}
5+
}

CODE-OF-CONDUCT.md

+14-10
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
1717
Examples of behavior that contributes to a positive environment for our
1818
community include:
1919

20-
- Demonstrating empathy and kindness toward other people
21-
- Being respectful of differing opinions, viewpoints, and experiences
22-
- Giving and gracefully accepting constructive feedback
23-
- Accepting responsibility and apologizing to those affected by our mistakes,
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
2424
and learning from the experience
25-
- Focusing on what is best not just for us as individuals, but for the overall
25+
* Focusing on what is best not just for us as individuals, but for the overall
2626
community
2727

2828
Examples of unacceptable behavior include:
2929

30-
- The use of sexualized language or imagery, and sexual attention or advances of
30+
* The use of sexualized language or imagery, and sexual attention or advances of
3131
any kind
32-
- Trolling, insulting or derogatory comments, and personal or political attacks
33-
- Public or private harassment
34-
- Publishing others' private information, such as a physical or email address,
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email address,
3535
without their explicit permission
36-
- Other conduct which could reasonably be considered inappropriate in a
36+
* Other conduct which could reasonably be considered inappropriate in a
3737
professional setting
3838

3939
## Enforcement Responsibilities
@@ -126,7 +126,11 @@ For answers to common questions about this code of conduct, see the FAQ at
126126
[https://www.contributor-covenant.org/translations][translations].
127127

128128
[homepage]: https://www.contributor-covenant.org
129+
129130
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131+
130132
[Mozilla CoC]: https://github.com/mozilla/diversity
133+
131134
[FAQ]: https://www.contributor-covenant.org/faq
135+
132136
[translations]: https://www.contributor-covenant.org/translations

CONTRIBUTING.md

+107-65
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Contributing to Android Jetpack Compose Library
22

3-
Thank you for considering contributing to our Android Jetpack Compose Library project. Your contributions help make this project better for everyone.
3+
Thank you for considering contributing to our Android Jetpack Compose Library
4+
project. Your contributions help make this project better for everyone.
45

56
## Table of Contents
7+
68
1. [Code of Conduct](#code-of-conduct)
79
2. [How to Contribute](#how-to-contribute)
810
3. [Reporting Issues](#reporting-issues)
@@ -15,138 +17,178 @@ Thank you for considering contributing to our Android Jetpack Compose Library pr
1517
10. [Creating ADRs](#creating-adrs)
1618

1719
## Code of Conduct
18-
This project adheres to a [Code of Conduct](./CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report any unacceptable behavior to [[email protected]](mailto:[email protected]).
20+
21+
This project adheres to a [Code of Conduct](./CODE_OF_CONDUCT.md). By
22+
participating, you are expected to uphold this code. Please report any
23+
unacceptable behavior
24+
1925

2026
## How to Contribute
27+
2128
### Reporting Issues
22-
If you find a bug or have a feature request, please open an issue in the [issue tracker](https://github.com/your-repo/compose-library/issues). Be sure to include:
23-
- A descriptive title.
24-
- A detailed explanation of the issue or request.
25-
- Steps to reproduce the issue (if applicable).
26-
- Any relevant screenshots or logs.
29+
30+
If you find a bug or have a feature request, please open an issue in
31+
the [issue tracker](https://github.com/your-repo/compose-library/issues). Be
32+
sure to include:
33+
34+
* A descriptive title.
35+
* A detailed explanation of the issue or request.
36+
* Steps to reproduce the issue (if applicable).
37+
* Any relevant screenshots or logs.
2738

2839
### Pull Requests
29-
We welcome your pull requests! To ensure a smooth process, please follow these steps:
40+
41+
We welcome your pull requests! To ensure a smooth process, please follow these
42+
steps:
3043

3144
1. **Fork the Repository:**
32-
- Create your own copy of the repository by clicking the `Fork` button on GitHub.
45+
* Create your own copy of the repository by clicking the `Fork` button on
46+
GitHub.
3347

3448
2. **Clone the Forked Repository:**
35-
- `git clone https://github.com/your-username/compose-library.git`
49+
* `git clone https://github.com/your-username/compose-library.git`
3650

3751
3. **Create a New Branch:**
38-
- `git checkout -b feature/your-feature-name`
52+
* `git checkout -b feature/your-feature-name`
3953

4054
4. **Make Your Changes:**
41-
- Develop your feature or fix on the new branch. Ensure that you follow the [coding standards](#coding-standards).
55+
* Develop your feature or fix on the new branch. Ensure that you follow
56+
the [coding standards](#coding-standards).
4257

4358
5. **Commit Your Changes:**
44-
- Use clear and concise commit messages.
45-
- `git commit -m "Add a concise and descriptive commit message"`
59+
* Use clear and concise commit messages.
60+
* `git commit -m "Add a concise and descriptive commit message"`
4661

4762
6. **Push Your Changes:**
48-
- `git push origin feature/your-feature-name`
63+
* `git push origin feature/your-feature-name`
4964

5065
7. **Submit a Pull Request:**
51-
- Go to the original repository and click `New pull request`.
52-
- Provide a detailed description of your changes.
53-
- Link to any relevant issues or ADRs if applicable.
66+
* Go to the original repository and click `New pull request`.
67+
* Provide a detailed description of your changes.
68+
* Link to any relevant issues or ADRs if applicable.
5469

5570
## Development Setup
71+
5672
Follow these steps to set up your development environment:
5773

5874
1. **Clone the Repository:**
59-
- `git clone https://github.com/your-repo/compose-library.git`
75+
* `git clone https://github.com/your-repo/compose-library.git`
6076

6177
2. **Navigate to the Project Directory:**
62-
- `cd compose-library`
78+
* `cd compose-library`
6379

6480
3. **Open the Project in Android Studio:**
65-
- Open the project folder in Android Studio:
66-
- File > Open... and select the cloned repository folder.
81+
* Open the project folder in Android Studio:
82+
* File > Open... and select the cloned repository folder.
6783

6884
4. **Sync Project with Gradle Files:**
69-
- Android Studio should automatically resolve and fetch dependencies when you open the project.
85+
* Android Studio should automatically resolve and fetch dependencies when
86+
you open the project.
7087

7188
5. **Run Tests:**
72-
- Ensure all tests pass by selecting `Run > Run...` and choosing the test configuration.
89+
* Ensure all tests pass by selecting `Run > Run...` and choosing the test
90+
configuration.
7391

7492
## Coding Standards
93+
7594
Please adhere to the following coding standards to ensure consistency:
7695

77-
- Follow the Kotlin Coding Conventions.
78-
- Follow Markdown and YAML style guides:
79-
- Markdown: Follow the [Markdown Guide](https://www.markdownguide.org/basic-syntax/).
80-
- YAML: Adhere to typical YAML syntax and style rules.
96+
* Follow the Kotlin Coding Conventions.
97+
* Follow Markdown and YAML style guides:
98+
* Markdown: Follow
99+
the [Markdown Guide](https://www.markdownguide.org/basic-syntax/).
100+
* YAML: Adhere to typical YAML syntax and style rules.
81101

82102
## Code Quality
83-
To maintain high code quality, we use the following linters and tools in our CI/CD pipeline. Please ensure your code adheres to these standards before submitting a pull request:
103+
104+
To maintain high code quality, we use the following linters and tools in our
105+
CI/CD pipeline. Please ensure your code adheres to these standards before
106+
submitting a pull request:
84107

85108
1. **Android Lint:**
86-
- Android Lint checks the code for potential bugs, stylistic errors, and other issues.
87-
- You can run Android Lint manually using the following command:
88-
```sh
89-
./gradlew lint
90-
```
109+
* Android Lint checks the code for potential bugs, stylistic errors, and
110+
other issues.
111+
* You can run Android Lint manually using the following command:
112+
113+
```sh
114+
./gradlew lint
115+
```
91116

92117
2. **Markdown Lint:**
93-
- Linting for Markdown can be done using `markdownlint-cli`:
94-
```sh
95-
npm install -g markdownlint-cli
96-
markdownlint '**/*.md'
97-
```
118+
* Linting for Markdown can be done using `markdownlint-cli`:
119+
120+
```sh
121+
npm install -g markdownlint-cli
122+
markdownlint '**/*.md'
123+
```
98124

99125
3. **YAML Lint:**
100-
- Linting for YAML files can be done using `yamllint`:
101-
```sh
102-
brew install yamllint
103-
yamllint .
104-
```
126+
* Linting for YAML files can be done using `yamllint`:
127+
128+
```sh
129+
brew install yamllint
130+
yamllint .
131+
```
105132

106133
### CI/CD Integration
107-
Our CI/CD pipeline will automatically run these linters on every pull request to ensure code quality. Here is a summary of the checks performed:
108134

109-
- **Android Lint:** Ensures Android code adheres to style and quality guidelines.
110-
- **Markdown Lint:** Checks Markdown files for style and syntax correctness.
111-
- **YAML Lint:** Checks YAML files for syntax errors and style issues.
135+
Our CI/CD pipeline will automatically run these linters on every pull request to
136+
ensure code quality. Here is a summary of the checks performed:
137+
138+
* **Android Lint:** Ensures Android code adheres to style and quality
139+
guidelines.
140+
* **Markdown Lint:** Checks Markdown files for style and syntax correctness.
141+
* **YAML Lint:** Checks YAML files for syntax errors and style issues.
112142

113143
Make sure your code passes these checks before opening a pull request.
114144

115145
## Documentation
146+
116147
Good documentation helps others understand your code. Please:
117148

118-
- Update the `DEVELOPMENT.md` file if your changes affect the development process.
119-
- Ensure your code is well-commented, especially for complex logic.
120-
- Update or create relevant ADRs in the `docs/adr` directory.
149+
* Update the `DEVELOPMENT.md` file if your changes affect the development
150+
process.
151+
* Ensure your code is well-commented, especially for complex logic.
152+
* Update or create relevant ADRs in the `docs/adr` directory.
121153

122154
## Running Tests
155+
123156
To run the test suite:
124157

125158
1. **Open the Project in Android Studio:**
126-
- Open the project folder in Android Studio.
159+
* Open the project folder in Android Studio.
127160

128161
2. **Run Tests:**
129-
- Run the test suite by selecting `Run > Run Tests` or by using the command:
130-
```sh
131-
./gradlew testDebugUnitTest
132-
./gradlew connectedAndroidTest
133-
```
162+
* Run the test suite by selecting `Run > Run Tests` or by using the command:
163+
164+
```sh
165+
./gradlew testDebugUnitTest
166+
./gradlew connectedAndroidTest
167+
```
134168

135169
Ensure that all tests pass before submitting your pull request.
136170

137171
## Creating ADRs
138-
Architecture Decision Records (ADRs) document significant architectural decisions made during the project. When you need to record an architectural decision, follow these steps:
172+
173+
Architecture Decision Records (ADRs) document significant architectural
174+
decisions made during the project. When you need to record an architectural
175+
decision, follow these steps:
139176

140177
1. **Create an ADR Document:**
141-
- ADRs should be created in the `docs/adr` directory.
142-
- Use the template provided in `docs/adr-xx-Template.md`.
178+
* ADRs should be created in the `docs/adr` directory.
179+
* Use the template provided in `docs/adr-xx-Template.md`.
143180

144181
2. **Document the Decision:**
145-
- Follow the structure in the template.
182+
* Follow the structure in the template.
146183

147184
3. **Review and Approval:**
148-
- Submit the ADR for review by creating a pull request.
149-
- The ADR must be approved by the Maintainers/Codeowners before it is merged. This ensures that all architectural decisions are aligned with the project's overall strategy.
185+
* Submit the ADR for review by creating a pull request.
186+
* The ADR must be approved by the Maintainers/Codeowners before it is
187+
merged. This ensures that all architectural decisions are aligned with the
188+
project's overall strategy.
189+
190+
## Thank You
150191
151-
## Thank You!
152-
Thank you for contributing to the Android Jetpack Compose Library project. Your efforts help improve the project for everyone. We appreciate your time and dedication!
192+
Thank you for contributing to the Android Jetpack Compose Library project. Your
193+
efforts help improve the project for everyone. We appreciate your time and
194+
dedication!

0 commit comments

Comments
 (0)