Skip to content

Commit

Permalink
#1649 MagicNumberCheck removed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Aug 12, 2022
1 parent 40b408a commit 82a30a3
Show file tree
Hide file tree
Showing 117 changed files with 1 addition and 146 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ SOFTWARE.
<plugin>
<groupId>com.qulice</groupId>
<artifactId>qulice-maven-plugin</artifactId>
<version>0.21.0</version>
<version>0.21.1</version>
<configuration>
<excludes combine.children="append">
<exclude>checkstyle:/src/site/resources/.*</exclude>
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/bytes/DigestEnvelope.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public abstract class DigestEnvelope implements Bytes {
* @param algrthm The algorithm
*/
public DigestEnvelope(final Input input, final String algrthm) {
// @checkstyle MagicNumber (1 line)
this(input, 16 << 10, algrthm);
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/bytes/HexOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
* Decodes origin {@link Text} using the hexadecimal encoding scheme.
*
* @since 0.30
* @checkstyle MagicNumberCheck (500 lines)
*/
public final class HexOf implements Bytes {
/**
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/bytes/InputAsBytes.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public final class InputAsBytes implements Bytes {
* @param input The input
*/
InputAsBytes(final Input input) {
// @checkstyle MagicNumber (1 line)
this(input, 16 << 10);
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/bytes/Md5DigestOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public Md5DigestOf(final Input input) {
* @param max Buffer size
*/
public Md5DigestOf(final Input input, final int max) {
// @checkstyle MagicNumber (1 line)
super(input, max, "MD5");
}
}
2 changes: 0 additions & 2 deletions src/main/java/org/cactoos/bytes/ReaderAsBytes.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ final class ReaderAsBytes implements Bytes {
* @param cset Charset
*/
ReaderAsBytes(final Reader rdr, final Charset cset) {
// @checkstyle MagicNumber (1 line)
this(rdr, cset, 16 << 10);
}

Expand All @@ -82,7 +81,6 @@ final class ReaderAsBytes implements Bytes {
* @since 0.13.2
*/
ReaderAsBytes(final Reader rdr, final CharSequence cset) {
// @checkstyle MagicNumber (1 line)
this(rdr, cset, 16 << 10);
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/bytes/Sha1DigestOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public Sha1DigestOf(final Input input) {
* @param max Buffer size
*/
public Sha1DigestOf(final Input input, final int max) {
// @checkstyle MagicNumber (1 line)
super(input, max, "SHA-1");
}
}
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/bytes/Sha256DigestOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public Sha256DigestOf(final Input input) {
* @param max Buffer size
*/
public Sha256DigestOf(final Input input, final int max) {
// @checkstyle MagicNumber (1 line)
super(input, max, "SHA-256");
}
}
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/func/Retry.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public final class Retry<X, Y> implements Func<X, Y> {
* @param fnc Func original
*/
public Retry(final Func<X, Y> fnc) {
// @checkstyle MagicNumberCheck (1 line)
this(fnc, 3);
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/io/GzipInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public final class GzipInput implements Input {
* @param input The input.
*/
public GzipInput(final Input input) {
// @checkstyle MagicNumberCheck (1 line)
this(input, 16 << 10);
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/io/GzipOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public final class GzipOutput implements Output {
* @param output The output
*/
public GzipOutput(final Output output) {
// @checkstyle MagicNumberCheck (1 line)
this(output, 16 << 10);
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/io/TailOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public final class TailOf implements Input {
* @param bytes Number of last bytes to show from input
*/
public TailOf(final Input inpt, final int bytes) {
// @checkstyle MagicNumber (1 line)
this(inpt, bytes, 16384);
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/io/TempFolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public TempFolder() {
new RangeOf<>('a', 'z', ch -> ++ch)
)
),
// @checkstyle MagicNumber (1 line)
() -> 5
)
)
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/io/WriterAsOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ final class WriterAsOutput implements Output {
* @param cset Charset
*/
WriterAsOutput(final Writer wtr, final Charset cset) {
// @checkstyle MagicNumber (1 line)
this(wtr, cset, 16 << 10);
}

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/cactoos/io/WriterAsOutputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ final class WriterAsOutputStream extends OutputStream {
* @param charset Charset
*/
WriterAsOutputStream(final Writer wtr, final CharSequence charset) {
// @checkstyle MagicNumber (1 line)
this(wtr, charset, 16 << 10);
}

Expand All @@ -90,7 +89,6 @@ final class WriterAsOutputStream extends OutputStream {
* @param charset Charset
*/
WriterAsOutputStream(final Writer wtr, final Charset charset) {
// @checkstyle MagicNumber (1 line)
this(wtr, charset.name());
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/iterable/IterableOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ public boolean equals(final Object other) {
).value();
}

// @checkstyle MagicNumberCheck (30 lines)
@Override
public int hashCode() {
return new Unchecked<>(
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/cactoos/scalar/HashCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public final class HashCode implements Scalar<Integer> {
* <p>The {@code initial} and {@code multiplier} values are arbitrarily
* set to 17 and 31 respectively.
* @param attributes The object's attributes
* @checkstyle MagicNumber (3 lines)
*/
public HashCode(final Object... attributes) {
this(new IterableOf<>(attributes));
Expand All @@ -80,7 +79,6 @@ public HashCode(final Object... attributes) {
* <p>The {@code initial} and {@code multiplier} values are arbitrarily
* set to 17 and 31 respectively.
* @param attributes The object's attributes
* @checkstyle MagicNumber (3 lines)
*/
public HashCode(final Iterable<?> attributes) {
this(17, 31, attributes);
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/scalar/LengthOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public LengthOf(final Text text) {
* @param input The input
*/
public LengthOf(final Input input) {
// @checkstyle MagicNumber (1 line)
this(input, 16 << 10);
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/scalar/Retry.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public Retry(final Scalar<? extends T> scalar) {
* @param wait The {@link Duration} to wait between attempts
*/
public Retry(final Scalar<? extends T> scalar, final Duration wait) {
// @checkstyle MagicNumberCheck (1 line)
this(scalar, 3, wait);
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/cactoos/text/HexOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public HexOf(final Bytes bytes) {
final char[] hex = new char[bts.length * 2];
int chr = -1;
for (int idx = 0; idx < bts.length; ++idx) {
// @checkstyle MagicNumber (3 line)
final int value = 0xff & bts[idx];
hex[++chr] = HexOf.HEX_CHARS[value >>> 4];
hex[++chr] = HexOf.HEX_CHARS[value & 0x0f];
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/bytes/BytesOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ void readsFromReader() throws Exception {
new BytesOf(
new StringReader(source),
StandardCharsets.UTF_8,
// @checkstyle MagicNumberCheck (1 line)
16 << 10
)
)
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/bytes/HexOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
* Test case for {@link HexOf}.
*
* @since 0.29
* @checkstyle MagicNumberCheck (500 line)
* @checkstyle JavadocMethodCheck (500 line)
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/collection/ImmutableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* Test case for {@link Immutable}.
*
* @since 1.16
* @checkstyle MagicNumber (500 lines)
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
@SuppressWarnings("PMD.TooManyMethods")
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/collection/NoNullsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
*
* @since 0.35
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle MagicNumberCheck (500 lines)
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
@SuppressWarnings("PMD.TooManyMethods")
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/experimental/ThreadsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
*
* @since 1.0.0
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
* @checkstyle MagicNumberCheck (500 lines)
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
final class ThreadsTest {
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/func/ChainedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
*
* @since 0.7
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle MagicNumber (500 line)
*/
final class ChainedTest {

Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/func/FallbackFromTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
*
* @since 0.31
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle MagicNumberCheck (500 lines)
*/
@SuppressWarnings("unchecked")
final class FallbackFromTest {
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/func/RepeatedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
*
* @since 0.13.1
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle MagicNumberCheck (500 line)
*/
final class RepeatedTest {

Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/func/RetryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
*
* @since 0.8
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle MagicNumberCheck (500 line)
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
final class RetryTest {
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/org/cactoos/io/DirectoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public void listsFilesAndFoldersInDirectory() throws IOException {
new Assertion<>(
"must list files in a directory represented by a path",
new Directory(dir),
// @checkstyle MagicNumber (1 line)
new HasSize(4)
).affirm();
}
Expand All @@ -69,7 +68,6 @@ public void listsFilesInDirectoryByFile() throws Exception {
new Assertion<>(
"must list files in a directory represented by a file",
new Directory(file),
// @checkstyle MagicNumber (1 line)
new HasSize(4)
).affirm();
}
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/io/HeadInputStreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
*
* @since 0.31
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle MagicNumberCheck (500 lines)
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/io/HeadOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
*
* @since 0.31
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle MagicNumberCheck (500 lines)
*/
final class HeadOfTest {

Expand Down
5 changes: 0 additions & 5 deletions src/test/java/org/cactoos/io/LoggingInputStreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ void readEmptyStream() throws IOException {
new Assertion<>(
"Empty stream did not return -1",
stream.read(),
// @checkstyle MagicNumberCheck (1 line)
new IsEqual<>(-1)
).affirm();
}
Expand All @@ -79,7 +78,6 @@ void readByteByByte() throws IOException {
final LoggingInputStream stream = new LoggingInputStream(
new ByteArrayInputStream(
new byte[] {
// @checkstyle MagicNumberCheck (2 lines)
(byte) 20,
(byte) 10,
}
Expand All @@ -89,19 +87,16 @@ void readByteByByte() throws IOException {
new Assertion<>(
"First byte was not 20",
stream.read(),
// @checkstyle MagicNumberCheck (1 line)
new IsEqual<>(20)
).affirm();
new Assertion<>(
"Second byte was not 10",
stream.read(),
// @checkstyle MagicNumberCheck (1 line)
new IsEqual<>(10)
).affirm();
new Assertion<>(
"When stream is exhausted it didn't return -1",
stream.read(),
// @checkstyle MagicNumberCheck (1 line)
new IsEqual<>(-1)
).affirm();
}
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/org/cactoos/io/LoggingInputTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ void logSkipFromLargeTextFile() throws Exception {
new ResourceOf("org/cactoos/large-text.txt"),
"text file",
logger
// @checkstyle MagicNumber (1 line)
).stream().skip(100);
new Assertion<>(
"Must log skip from text file",
Expand Down Expand Up @@ -191,7 +190,6 @@ void logResetFromLargeTextFile() throws Exception {
"text file",
logger
).stream();
// @checkstyle MagicNumber (1 line)
input.mark(150);
input.reset();
new Assertion<>(
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/org/cactoos/io/ResourceOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ public void readsBinaryResource() throws Exception {
"org/cactoos/io/ResourceOfTest.class"
)
).asBytes(),
// @checkstyle MagicNumber (2 lines)
0,
4
),
new IsEqual<>(
new byte[]{
// @checkstyle MagicNumber (1 line)
(byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE,
}
)
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/io/SlowInputStreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* Test for {@link SlowInputStream}.
*
* @since 0.47
* @checkstyle MagicNumberCheck (40 lines)
*/
final class SlowInputStreamTest {

Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/cactoos/io/StickyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ void readsFileContent() {
new Repeated<>(
input -> new BytesOf(
new TeeInput(input, new DeadOutput())
// @checkstyle MagicNumber (2 lines)
).asBytes().length == 74_536,
10
)
Expand Down
3 changes: 0 additions & 3 deletions src/test/java/org/cactoos/io/WriterAsOutputStreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public void writesToByteArray() {
baos, StandardCharsets.UTF_8
),
StandardCharsets.UTF_8,
// @checkstyle MagicNumber (1 line)
13
)
)
Expand All @@ -95,7 +94,6 @@ public void writesLargeContentToFile() throws IOException {
new WriterAsOutputStream(
writer,
StandardCharsets.UTF_8,
// @checkstyle MagicNumber (1 line)
345
)
)
Expand All @@ -122,7 +120,6 @@ public void writesToFileAndRemovesIt() throws Exception {
new WriterAsOutputStream(
writer,
StandardCharsets.UTF_8,
// @checkstyle MagicNumber (1 line)
345
)
)
Expand Down
Loading

0 comments on commit 82a30a3

Please sign in to comment.