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

Hw 0 solution #1400

Open
wants to merge 8 commits into
base: update-task
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Java CI

on: [push, pull_request_target]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
- uses: mate-academy/auto-approve-action@v2
if: ${{ github.event.pull_request && success() }}
with:
github-token: ${{ github.token }}
- uses: mate-academy/auto-reject-action@v2
if: ${{ github.event.pull_request && failure() }}
with:
github-token: ${{ github.token }}
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
# Checkstyle intro
# Checkstyle Introduction

In this repository, you will find code that has some code style issues. Your task is to identify and fix all the checkstyle issues.

First, try to review the code independently to detect the code style issues and fix them. When you are ready, you can execute the `mvn clean package` command. Observe the console output, where you will either see a message indicating that the build was successful, or a list of code style issues that need to be addressed.

Continue to fix all code style issues until you receive console output similar to this:
```text
...

[INFO]
[INFO] --- maven-checkstyle-plugin:3.1.1:check (default) @ diamond ---
[INFO] Starting audit...
Audit done.
[INFO] You have 0 Checkstyle violations.
[INFO]

...

-------------------------------------------------------
T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ diamond ---
[INFO] Building jar: /home/runner/work/checkstyle-intro/checkstyle-intro/target/diamond-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.658 s
[INFO] Finished at: 2024-01-18T10:48:28Z
[INFO] ------------------------------------------------------------------------

...

```

> NOTE: Some parts of the console log have been omitted and replaced with `...`.

> NOTE 2: Pay special attention to the lines `[INFO] You have 0 Checkstyle violations.` and `[INFO] BUILD SUCCESS`. These lines indicate the successful completion of our task.

Once you are ready, don't forget to create a PR with your solution and verify all GitHub checks passed.

Good luck!
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.1</version>
<version>3.3.1</version>
<executions>
<execution>
<phase>compile</phase>
Expand All @@ -42,7 +42,6 @@
</executions>
<configuration>
<configLocation>${maven.checkstyle.plugin.configLocation}</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/core/basesyntax/Hello_World.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@
import core.basesyntax.Model.Cat;

import java.time.LocalDate;
import java.util.Objects;

public class Hello_World
{
private String a;
private int vARIaBLE;
private int age, size;
String a;
int vARIaBLE;
int age, size;


public static void main(String[] args) {
Dog dog = new Dog();
Cat cat = new Cat(); }

private String getFromOneToTen() {
String result="";
StringBuilder result= new StringBuilder();

for (int i=0; i<10; i++){
if(i%2==0)
result = result + i + " ";
for (int i=0; i<10; i++)
if (i % 2 == 0){
result.append(" ").append(i);
}
return result;
return result.toString();
}

private void sayHello(String HELLO) {
Expand Down
7 changes: 3 additions & 4 deletions src/test/java/core/basesyntax/HelloWorldTest.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package core.basesyntax;

/**
* Feel free to remove this class and create your own.
*/
public class HelloWorldTest {
public static void main(String[] args) {
System.out.println("Hello World!");
}

}
Loading