Skip to content

Commit

Permalink
Add new code hygiene workflow (opensearch-project#1699)
Browse files Browse the repository at this point in the history
New workflow for running linters / checks to make sure the code base
continues to follow best practices.

Adding a new-line linter to make sure all files end with a single
newline.  This is a POSIX standard, read more https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline

Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied authored Mar 24, 2022
1 parent acbf68e commit ae6ac72
Show file tree
Hide file tree
Showing 186 changed files with 196 additions and 185 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ If applicable, add screenshots to help explain your problem.
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ A clear and concise description of what you want to happen.
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
Add any other context or screenshots about the feature request here.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ Is this a backport? If so, please add backport PR # and/or commits #
- [ ] Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check [here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).
For more information on following Developer Certificate of Origin and signing off your commits, please check [here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).
14 changes: 14 additions & 0 deletions .github/workflows/code-hygiene.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Code Hygiene

on: [push, pull_request]

jobs:
linelint:
runs-on: ubuntu-latest
name: Check if all files end in newline
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Linelint
uses: fernandrone/[email protected]
2 changes: 1 addition & 1 deletion .github/workflows/delete_backport_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
- name: Delete merged branch
uses: SvanBoxel/delete-merged-branch@b77e873cee00b09f55cc553bd24aae5f8dfc9157
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ IML
# gradle
build/
gradle-build/
.gradle/
.gradle/
17 changes: 17 additions & 0 deletions .linelint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 'true' will fix files
autofix: true

# list of paths to ignore, uses gitignore syntaxes (executes before any rule)
ignore:
- .git/
- .gradle/
- src/test/resources/restapi/users_key_not_quoted.json

rules:
# checks if file ends in a newline character
end-of-file:
# set to true to enable this rule
enable: true

# if true also checks if file ends in a single newline character
single-new-line: true
2 changes: 1 addition & 1 deletion .whitesource
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"issueSettings": {
"minSeverityLevel": "LOW"
}
}
}
2 changes: 1 addition & 1 deletion ADMINS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
| --------------- | --------------------------------------- | ----------- |
| Henri Yandell | [hyandell](https://github.com/hyandell) | Amazon |

[This document](https://github.com/opensearch-project/.github/blob/main/ADMINS.md) explains what admins do in this repo. and how they should be doing it. If you're interested in becoming a maintainer, see [MAINTAINERS](MAINTAINERS.md). If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
[This document](https://github.com/opensearch-project/.github/blob/main/ADMINS.md) explains what admins do in this repo. and how they should be doing it. If you're interested in becoming a maintainer, see [MAINTAINERS](MAINTAINERS.md). If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Contributing to this Project

OpenSearch is a community project that is built and maintained by people just like **you**.
[This document](https://github.com/opensearch-project/.github/blob/main/CONTRIBUTING.md) explains how you can contribute to this and related projects.
[This document](https://github.com/opensearch-project/.github/blob/main/CONTRIBUTING.md) explains how you can contribute to this and related projects.
2 changes: 1 addition & 1 deletion DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@ The Github workflow in [`backport.yml`](.github/workflows/backport.yml) creates
original PR with an appropriate label `backport <backport-branch-name>` is merged to main with the backport workflow
run successfully on the PR. For example, if a PR on main needs to be backported to `1.x` branch, add a label
`backport 1.x` to the PR and make sure the backport workflow runs on the PR along with other checks. Once this PR is
merged to main, the workflow will create a backport PR to the `1.x` branch.
merged to main, the workflow will create a backport PR to the `1.x` branch.
2 changes: 1 addition & 1 deletion MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
| Peter Nied | [peternied](https://github.com/peternied) | Amazon |

### Updating Practices
To ensure common practices as maintainers, all practices are expected to be documented here or enforced through github actions. There should be no expectations beyond what is documented in the repo [CONTRIBUTING.md](./CONTRIBUTING.md) and OpenSearch-Project [CONTRIBUTING.md](https://github.com/opensearch-project/.github/blob/main/CONTRIBUTING.md). To modify an existing processes or create a new one, make a pull request on this MAINTAINERS.md for review and merge it after all maintainers approve of it.
To ensure common practices as maintainers, all practices are expected to be documented here or enforced through github actions. There should be no expectations beyond what is documented in the repo [CONTRIBUTING.md](./CONTRIBUTING.md) and OpenSearch-Project [CONTRIBUTING.md](https://github.com/opensearch-project/.github/blob/main/CONTRIBUTING.md). To modify an existing processes or create a new one, make a pull request on this MAINTAINERS.md for review and merge it after all maintainers approve of it.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ This code is licensed under the Apache 2.0 License.

## Copyright

Copyright OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details.
Copyright OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details.
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
This project follows the [OpenSearch release process](https://github.com/opensearch-project/.github/blob/main/RELEASING.md).
This project follows the [OpenSearch release process](https://github.com/opensearch-project/.github/blob/main/RELEASING.md).
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Reporting a Vulnerability

If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/) or directly via email to [email protected]. Please do **not** create a public GitHub issue.
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/) or directly via email to [email protected]. Please do **not** create a public GitHub issue.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -386,4 +386,4 @@ buildRpm {
buildDeb {
arch = 'all'
archiveName "${packageName}-${version}.deb"
}
}
2 changes: 1 addition & 1 deletion config/checkstyle/sun_checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,4 @@

</module>

</module>
</module>
2 changes: 1 addition & 1 deletion legacy/securityconfig_v6/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,4 @@ opendistro_security:
transport_enabled: false
authorization_backend:
type: ldap #
#config goes here ...
#config goes here ...
2 changes: 1 addition & 1 deletion legacy/securityconfig_v6/internal_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ readall:
snapshotrestore:
hash: $2y$12$DpwmetHKwgYnorbgdvORCenv4NAK8cPUg8AI6pxLCuWf/ALc0.v7W
roles:
- snapshotrestore
- snapshotrestore
2 changes: 1 addition & 1 deletion legacy/securityconfig_v6/roles_mapping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ opendistro_security_manage_snapshots:

opendistro_security_own_index:
users:
- '*'
- '*'
2 changes: 1 addition & 1 deletion plugin-security.policy
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ grant {

grant codeBase "${codebase.netty-common}" {
permission java.lang.RuntimePermission "loadLibrary.*";
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ Compatible with Elasticsearch version 7.9.1
* Generate SHA-512 checksum for opendistro_security .zip only (exclude securityadmin-standalone) [#753](https://github.com/opendistro-for-elasticsearch/security/pull/753)
* Consolidate writeable resource validation check [#752](https://github.com/opendistro-for-elasticsearch/security/pull/752)
* Exclude jakarta.activation-api library from CXF transient dependencies to avoid conflict with jakarata.activation. [#751](https://github.com/opendistro-for-elasticsearch/security/pull/751)
* Upgrade Apache CXF to 3.4.0 [#717](https://github.com/opendistro-for-elasticsearch/security/pull/717)
* Upgrade Apache CXF to 3.4.0 [#717](https://github.com/opendistro-for-elasticsearch/security/pull/717)
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
- Fixed bug which caused user to lose roles on account password update
- Refactored to use Greenrobot EventBus
- Refactored Resolved class, dropped unused fields and simplified logic
- Refactored audit logging and compliance config classes
- Refactored audit logging and compliance config classes
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ Compatible with OpenSearch 1.0.0-beta1
* Change opensearch version to use ([#1146](https://github.com/opensearch-project/security/pull/1146))
* Fix echo messages and anchor links ([#1147](https://github.com/opensearch-project/security/pull/1147))
* Update static roles for compatibility for new indices used in OpenSearch Dashboards ([#1148](https://github.com/opensearch-project/security/pull/1148))
* Update release note for OpenSearch Security Plugin `1.0.0.0-beta1`([#1152](https://github.com/opensearch-project/security/pull/1152))
* Update release note for OpenSearch Security Plugin `1.0.0.0-beta1`([#1152](https://github.com/opensearch-project/security/pull/1152))
2 changes: 1 addition & 1 deletion release-notes/opensearch-security.release-notes-1.2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Compatible with OpenSearch 1.2.0
* Bump xmlsec from 2.2.0 to 2.2.3 ([#1450](https://github.com/opensearch-project/security/pull/1450))
* Create 1.2.0.0 release notes ([#1494](https://github.com/opensearch-project/security/pull/1494))
* Updated copyright notices ([#1477](https://github.com/opensearch-project/security/pull/1477))
* Updated release notes for 1.2 with copyright updates ([#1496](https://github.com/opensearch-project/security/pull/1496))
* Updated release notes for 1.2 with copyright updates ([#1496](https://github.com/opensearch-project/security/pull/1496))
2 changes: 1 addition & 1 deletion release-notes/opensearch-security.release-notes-1.2.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Compatible with OpenSearch 1.2.1

### Maintenance

* Bumping log4j to 2.15.0 ([#1520](https://github.com/opensearch-project/security/pull/1520))
* Bumping log4j to 2.15.0 ([#1520](https://github.com/opensearch-project/security/pull/1520))
2 changes: 1 addition & 1 deletion release-notes/opensearch-security.release-notes-1.2.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Compatible with OpenSearch 1.2.3

### Maintenance

* Bump log4j-core from 2.16.0 to 2.17.0 ([#1535](https://github.com/opensearch-project/security/pull/1535))
* Bump log4j-core from 2.16.0 to 2.17.0 ([#1535](https://github.com/opensearch-project/security/pull/1535))
2 changes: 1 addition & 1 deletion release-notes/opensearch-security.release-notes-1.2.4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Compatible with OpenSearch 1.2.4
* Bump log4j-core from 2.17.0 to 2.17.1 ([#1551](https://github.com/opensearch-project/security/pull/1551))
* Update CXF version to 3.4.5 ([#1540](https://github.com/opensearch-project/security/pull/1540))
* Version bump to 1.2.4.0 ([#1558](https://github.com/opensearch-project/security/pull/1558))
* Release notes for 1.2.4.0 ([#1569](https://github.com/opensearch-project/security/pull/1569))
* Release notes for 1.2.4.0 ([#1569](https://github.com/opensearch-project/security/pull/1569))
2 changes: 1 addition & 1 deletion securityconfig/action_groups.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_meta:
type: "actiongroups"
config_version: 2
config_version: 2
2 changes: 1 addition & 1 deletion securityconfig/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,4 @@ config:
# time_window_seconds: 3600
# block_expiry_seconds: 600
# max_blocked_clients: 100000
# max_tracked_clients: 100000
# max_tracked_clients: 100000
2 changes: 1 addition & 1 deletion securityconfig/internal_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ snapshotrestore:
reserved: false
backend_roles:
- "snapshotrestore"
description: "Demo snapshotrestore user"
description: "Demo snapshotrestore user"
1 change: 0 additions & 1 deletion src/main/assemblies/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@
</fileSet>
</fileSets>
</assembly>

2 changes: 1 addition & 1 deletion src/main/assemblies/securityadmin-standalone.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
</excludes>
</dependencySet>
</dependencySets>
</assembly>
</assembly>
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ public void setJwksUri(String jwksUri) {
this.jwksUri = jwksUri;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -421,4 +421,4 @@ private static enum HttpMethod {
}


}
}
2 changes: 1 addition & 1 deletion src/main/java/org/opensearch/security/auth/AuthDomain.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ public String toString() {
public int compareTo(final AuthDomain o) {
return Integer.compare(this.order, o.order);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@
public interface AuthFailureListener {
void onAuthFailure(InetAddress remoteAddress, AuthCredentials authCredentials, Object request);
}

Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@ public void onInternalUsersModelChanged(InternalUsersModel ium) {
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -595,4 +595,3 @@ static Mode get(Settings settings) {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,3 @@ boolean containsTermLookupQuery(String query) {


}

Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@ protected void consumeParameters(final RestRequest request) {
request.paramAsBoolean("accept_invalid", false);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ public TenantValidator(final RestRequest request, boolean isSuperAdmin, BytesRef
if (isSuperAdmin) allowedKeys.put("reserved", DataType.BOOLEAN);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ public static enum PrivilegesEvaluatorResponseState {
COMPLETE;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ public abstract class ConfigModel {
public abstract SecurityRoles getSecurityRoles();

public abstract Set<String> getAllConfiguredTenantNames();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ public String getRequestMethod() {
return requestMethod;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ public String toString() {
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,4 @@ public String toString() {

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ public boolean isReserved() {
return readonly;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@ public boolean isReserved() {
return readonly;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ public String toString() {



}
}
Original file line number Diff line number Diff line change
Expand Up @@ -460,4 +460,4 @@ public String toString() {

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,4 @@ public void setStatic(boolean _static) {
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ public String toString() {



}
}
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,4 @@ public String toString() {



}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ public String toString() {
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -385,4 +385,3 @@ public static char[] randomChars(int len) {

private PemKeyReader() { }
}

Loading

0 comments on commit ae6ac72

Please sign in to comment.