Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/artipie/artipie
Browse files Browse the repository at this point in the history
  • Loading branch information
olenagerasimova committed Jan 29, 2024
2 parents ed8b71d + 1860d51 commit 7da15d3
Show file tree
Hide file tree
Showing 738 changed files with 624 additions and 1,456 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
restore-keys: |
${{ runner.os }}-jdk-21-maven-
- name: Build it with Maven
run: mvn -B install -Pqulice
run: mvn -B install
xcop-lint:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ they don't violate our quality standards. To avoid frustration, before
sending us your pull request please run full Maven build:

```
mvn clean verify -Pqulice
mvn clean verify
```

After submitting pull-request check CI status checks. If any check with "required" label fails,
Expand Down Expand Up @@ -42,7 +42,7 @@ This is a build and test pipeline for artipie main assembly verification:

## Code style

Code style is enforced by "qulice" Maven plugin which aggregates multiple rules for "checkstyle" and "PMD".
Code style is enforced by "pmd-maven-plugin" Maven plugin which applies project PMD rule set.

There are some additional recommendation for code style which are not covered by automatic checks:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ they don't violate our quality standards. To avoid frustration, before
sending us your pull request please run full Maven build:

```
$ mvn clean install -Pqulice
$ mvn clean install
```

To avoid build errors use Maven 3.2+ and please read
Expand Down
4 changes: 3 additions & 1 deletion artipie-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
<artifactId>artipie-core</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
<header.license>${project.basedir}/../LICENSE.header</header.license>
</properties>
<dependencies>
<dependency>
<groupId>com.artipie</groupId>
Expand Down
6 changes: 3 additions & 3 deletions artipie-core/src/main/java/com/artipie/http/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public interface Connection {
*/
@Deprecated
default CompletionStage<Void> accept(
RsStatus status,
Iterable<Map.Entry<String, String>> headers,
Publisher<ByteBuffer> body
final RsStatus status,
final Iterable<Map.Entry<String, String>> headers,
final Publisher<ByteBuffer> body
) {
return this.accept(status, new Headers.From(headers), body);
}
Expand Down
1 change: 0 additions & 1 deletion artipie-core/src/main/java/com/artipie/http/Headers.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* HTTP request headers.
*
* @since 0.8
* @checkstyle InterfaceIsTypeCheck (2 lines)
*/
public interface Headers extends Iterable<Map.Entry<String, String>> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public String getFactoryName(final Class<?> clazz) {
.map(inst -> ((ArtipieAuthFactory) inst).value())
.findFirst()
.orElseThrow(
// @checkstyle LineLengthCheck (1 lines)
() -> new ArtipieException("Annotation 'ArtipieAuthFactory' should have a not empty value")
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
* Authentication scheme such as Basic, Bearer etc.
*
* @since 0.17
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle JavadocVariableCheck (500 lines)
* @checkstyle AvoidInlineConditionalsCheck (500 lines)
* @checkstyle OperatorWrapCheck (500 lines)
* @checkstyle StringLiteralsConcatenationCheck (500 lines)
*/
@SuppressWarnings({"PMD.ProhibitPublicStaticMethods",
"PMD.ConstructorOnlyInitializesOrCallOtherConstructors"})
Expand Down Expand Up @@ -51,7 +46,7 @@ public String challenge() {
* @param headers Request headers.
* @return Authentication result.
*/
default CompletionStage<Result> authenticate(Iterable<Map.Entry<String, String>> headers) {
default CompletionStage<Result> authenticate(final Iterable<Map.Entry<String, String>> headers) {
return this.authenticate(headers, "");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
* Slice with authorization.
*
* @since 1.2
* @checkstyle ReturnCountCheck (500 lines)
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle ParameterNumberCheck (500 lines)
* @checkstyle NestedIfDepthCheck (500 lines)
* @checkstyle MethodBodyCommentsCheck (500 lines)
* @checkstyle AvoidInlineConditionalsCheck (500 lines)
*/
@SuppressWarnings("PMD.OnlyOneReturn")
public final class AuthzSlice implements Slice {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* Basic authentication method.
*
* @since 0.17
* @checkstyle ReturnCountCheck (500 lines)
*/
@SuppressWarnings("PMD.OnlyOneReturn")
public final class BasicAuthScheme implements AuthScheme {
Expand Down Expand Up @@ -64,7 +63,7 @@ public CompletionStage<Result> authenticate(
*/
private Optional<AuthUser> user(final String header) {
final Authorization atz = new Authorization(header);
if (atz.scheme().equals(BasicAuthScheme.NAME)) {
if (BasicAuthScheme.NAME.equals(atz.scheme())) {
final Authorization.Basic basic = new Authorization.Basic(atz.credentials());
return this.auth.user(basic.username(), basic.password());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* Bearer authentication method.
*
* @since 0.17
* @checkstyle ReturnCountCheck (500 lines)
*/
@SuppressWarnings("PMD.OnlyOneReturn")
public final class BearerAuthScheme implements AuthScheme {
Expand Down Expand Up @@ -70,7 +69,7 @@ public CompletionStage<Result> authenticate(final Iterable<Map.Entry<String, Str
*/
private CompletionStage<Optional<AuthUser>> user(final String header) {
final Authorization atz = new Authorization(header);
if (atz.scheme().equals(BearerAuthScheme.NAME)) {
if (BearerAuthScheme.NAME.equals(atz.scheme())) {
return this.auth.user(
new Authorization.Bearer(atz.credentials()).token()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
* Instances of this class are created in the adapter with users' policies and required
* permission for the adapter's operation.
* @since 1.2
* @checkstyle StringLiteralsConcatenationCheck (500 lines)
* @checkstyle AvoidInlineConditionalsCheck (500 lines)
*/
public final class OperationControl {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public String getFactoryName(final Class<?> clazz) {
.map(inst -> ((ArtipieFilterFactory) inst).value())
.findFirst()
.orElseThrow(
// @checkstyle LineLengthCheck (1 lines)
() -> new ArtipieException(
String.format(
"Annotation '%s' should have a not empty value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class FilterSlice implements Slice {
* Ctor.
* @param origin Origin slice
* @param yaml Yaml mapping to read filters from
* @checkstyle HiddenFieldCheck (10 lines)
*/
public FilterSlice(final Slice origin, final YamlMapping yaml) {
this(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ final class GroupResult {

/**
* Subscriber which cancel publisher subscription.
* @checkstyle AnonInnerLengthCheck (25 lines)
*/
private static final Subscriber<? super Object> CANCEL_SUB = new Subscriber<Object>() {
@Override
Expand Down Expand Up @@ -106,7 +105,6 @@ public CompletionStage<Void> replay(final Connection con) {
*/
public boolean success() {
final int code = Integer.parseInt(this.status.code());
// @checkstyle MagicNumberCheck (1 line)
return code >= 200 && code < 300;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ private GroupResults(final List<GroupResult> list, final CompletableFuture<Void>
* @param result Repayable result
* @param con Connection to use for replay
* @return Future
* @checkstyle ReturnCountCheck (25 lines)
*/
@SuppressWarnings("PMD.OnlyOneReturn")
public CompletionStage<Void> complete(final int order, final GroupResult result,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public Accept(final Iterable<Map.Entry<String, String>> headers) {
* Parses `Accept` header values, sorts them according to weight and returns in
* corresponding order.
* @return Set or the values
* @checkstyle ReturnCountCheck (11 lines)
*/
@SuppressWarnings("PMD.OnlyOneReturn")
public List<String> values() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public SliceHasResponse(final Matcher<? extends Response> rsp, final Headers hea
* @param line Request line
* @param headers Headers
* @param body Body
* @checkstyle ParameterNumberCheck (5 lines)
*/
public SliceHasResponse(final Matcher<? extends Response> rsp, final RequestLine line,
final Headers headers, final Content body) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ public byte[] array() {
@SuppressWarnings("PMD.NullAssignment")
public void close() {
this.check();
// @checkstyle MethodBodyCommentsCheck (1 lines)
// assign to null means broken state, it's verified by `check` method.
this.buffer = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
* @implNote The state could be broken in case of runtime exception occurs during
* the tokenization process, it couldn't be recovered and should not be used after failure
* @since 1.0
* @checkstyle MethodBodyCommentsCheck (500 lines)
*/
@NotThreadSafe
public final class ByteBufferTokenizer implements Closeable {
Expand Down Expand Up @@ -161,7 +160,6 @@ private void flush() {
*/
private static int indexOf(final int offset, final byte[] array, final byte[] token) {
int res = -1;
// @checkstyle LocalVariableNameCheck (10 lines)
TOP: for (int i = offset; i < array.length - token.length + 1; ++i) {
boolean found = true;
for (int j = 0; j < token.length; ++j) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ public void request(final long amt) {

/**
* Check if all required parts are connected, and request from upstream if so.
* @checkstyle MethodBodyCommentsCheck (10 lines)
*/
private void checkRequest() {
synchronized (this.lock) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
/**
* Provides random free port.
* @since 0.18
* @checkstyle NonStaticMethodCheck (500 lines)
*/
public final class RandomFreePort {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ public void cancel() {

/**
* Notify item received.
* @checkstyle NonStaticMethodCheck (10 lines)
*/
*/
public void receive() {
// not implemented
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public String version() {
*/
private String part(final int idx) {
final String[] parts = this.line.trim().split("\\s");
// @checkstyle MagicNumberCheck (1 line)
if (parts.length == 3) {
return parts[idx];
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ final class Completion<T> {
/**
* Fake implementation for tests.
* @since 1.0
* @checkstyle AnonInnerLengthCheck (25 lines)
*/
static final Completion<?> FAKE = new Completion<>(
new Subscriber<Object>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
/**
* Multipart request part.
* @since 1.0
* @checkstyle MethodBodyCommentsCheck (500 lines)
*/
@SuppressWarnings("PMD.NullAssignment")
final class MultiPart implements RqMultipart.Part, ByteBufferTokenizer.Receiver, Subscription {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* Multipart parts publisher.
*
* @since 1.0
* @checkstyle MethodBodyCommentsCheck (500 lines)
*/
final class MultiParts implements Processor<ByteBuffer, RqMultipart.Part>,
ByteBufferTokenizer.Receiver {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ public void ignore(final Part part) {
* Create filter single source which either returns accepted item, or
* drain ignored item and return empty after that.
* @return Single source
* @checkstyle ReturnCountCheck (20 lines)
*/
*/
@SuppressWarnings({"PMD.ConfusingTernary", "PMD.OnlyOneReturn"})
Single<? extends Part> filter() {
if (this.accepted != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
* This class defines all state and its transition and provide method to patch and check the state.
* </p>
* @since 1.0
* @checkstyle MagicNumberCheck (50 lines)
*/
@SuppressWarnings("PMD.AvoidAccessToStaticMembersViaThis")
final class State {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ final class ServletConnection implements Connection {
this.rsp = rsp;
}

// @checkstyle ReturnCountCheck (10 lines)
@Override
@SuppressWarnings("PMD.OnlyOneReturn")
public CompletionStage<Void> accept(final RsStatus status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
* Slice wrapper for using in servlet API. Class is not used in Artipie, but required for
* CloudArtifact project.
* @since 0.18
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
public final class ServletSliceWrap {

Expand Down Expand Up @@ -79,8 +78,6 @@ public void handle(final AsyncContext ctx) {
* @param req Servlet request
* @param rsp Servlet response
* @return Future
* @checkstyle ReturnCountCheck (10 lines)
* @checkstyle IllegalCatchCheck (30 lines)
*/
@SuppressWarnings({"PMD.OnlyOneReturn", "PMD.AvoidCatchingGenericException"})
public CompletionStage<Void> handle(final HttpServletRequest req,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
/**
* Slice that gzips requested content.
* @since 1.1
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
final class GzipSlice implements Slice {

Expand Down Expand Up @@ -60,8 +59,8 @@ public Response response(final String line, final Iterable<Map.Entry<String, Str
* @param body Origin response body
* @param headers Origin response headers
* @return Completable action
* @checkstyle ParameterNumberCheck (5 lines)
*/
@SuppressWarnings("PMD.CloseResource")
private static CompletionStage<Void> gzip(final Connection connection, final RsStatus stat,
final Publisher<ByteBuffer> body, final Headers headers) {
final CompletionStage<Void> future;
Expand All @@ -81,7 +80,6 @@ private static CompletionStage<Void> gzip(final Connection connection, final RsS
)
);
try (GZIPOutputStream gzos = new GZIPOutputStream(resout)) {
// @checkstyle MagicNumberCheck (1 line)
final byte[] buffer = new byte[1024 * 8];
while (true) {
final int length = oinput.read(buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
* We should replace {@link HeadSlice} of artipie/files-adapter by
* this one. Before doing this task, be sure that at least version
* 1.8.1 of artipie/http has been released.
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
public final class HeadSlice implements Slice {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public interface ListingFormat {
/**
* Standard format implementations.
* @since 1.1.0
* @checkstyle IndentationCheck (30 lines)
*/
enum Standard implements ListingFormat {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
* Slice that logs incoming requests and outgoing responses.
*
* @since 0.8
* @checkstyle IllegalCatchCheck (500 lines)
*/
@SuppressWarnings("PMD.AvoidCatchingGenericException")
public final class LoggingSlice implements Slice {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public SliceListing(
* @param transform Transformation
* @param mtype Mime type
* @param format Format of a key collection
* @checkstyle ParameterNumberCheck (20 lines)
*/
public SliceListing(
final Storage storage,
Expand Down
Loading

0 comments on commit 7da15d3

Please sign in to comment.