Skip to content

Commit

Permalink
Add .editorconfig to help with formatting (#760)
Browse files Browse the repository at this point in the history
* Reformated imports for all Java files
* Formatted some files (IntellJ issue)
* Updated contributing.adoc
  • Loading branch information
abelsromero authored Jan 27, 2024
1 parent 35ec5c0 commit d7e577a
Show file tree
Hide file tree
Showing 74 changed files with 566 additions and 505 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
tab_width = 4

[*.java]
ij_java_class_count_to_use_import_on_demand = 99
ij_java_imports_layout = javax.**, java.**, |, *, |, $*

[{*.yml,*.yaml}]
indent_size = 2
2 changes: 1 addition & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Improvements::
* Upgrade Asciidoctorj to v2.5.10 and jRuby to v9.4.2.0 (#647)
* Upgrade Asciidoctorj to v2.5.11 (#688)
* Improve warning message when destination file is going to be replaced (#728)
* Added `.editorconfig` file to facilitate code formatting (#760)

Build / Infrastructure::

Expand Down Expand Up @@ -66,7 +67,6 @@ Build / Infrastructure::
* Automate release using GH Actions (#141)
* Ensure Mojos use correct default values in unit tests (#609)


Maintenance::
* Replace use of reflection by direct JavaExtensionRegistry calls to register extensions (#596)

Expand Down
4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
= Asciidoctor Maven Tools (Plugin & Site Integration)
// Metadata
:release-version: 2.2.2
:release-version: 2.2.5
:docs-version: 2.2
:maven-site-plugin-version: 3.9.0
:maven-site-plugin-version: 3.12.1
// Settings
:idprefix:
:idseparator: -
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package org.asciidoctor.maven.site;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;
import java.io.StringReader;

import lombok.SneakyThrows;
import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.sink.Sink;
Expand All @@ -9,8 +15,6 @@
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import java.io.*;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.codehaus.plexus.util.ReflectionUtils.setVariableValueInObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.asciidoctor.maven.log;

import org.asciidoctor.ast.Cursor;
import org.asciidoctor.log.LogRecord;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import org.asciidoctor.ast.Cursor;
import org.asciidoctor.log.LogRecord;

public class LogRecordFormatter {

private static final String MESSAGE_HEADER = "asciidoctor";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.asciidoctor.maven.log;

import org.asciidoctor.log.LogRecord;
import org.asciidoctor.log.Severity;

import java.io.File;
import java.util.List;
import java.util.function.Consumer;

import org.asciidoctor.log.LogRecord;
import org.asciidoctor.log.Severity;

public class LogRecordsProcessors {

private final LogHandler logHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.asciidoctor.maven.log;

import org.asciidoctor.log.LogHandler;
import org.asciidoctor.log.LogRecord;
import org.asciidoctor.log.Severity;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import org.asciidoctor.log.LogHandler;
import org.asciidoctor.log.LogRecord;
import org.asciidoctor.log.Severity;


/**
* AsciidoctorJ LogHandler that stores records in memory.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.asciidoctor.maven.site;

import org.asciidoctor.Options;

import java.util.List;

import org.asciidoctor.Options;

public class SiteConversionConfiguration {

private final Options options;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
package org.asciidoctor.maven.site;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.maven.project.MavenProject;
import org.asciidoctor.AttributesBuilder;
import org.asciidoctor.Options;
Expand All @@ -8,11 +17,6 @@
import org.asciidoctor.maven.commons.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;

import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.asciidoctor.maven.commons.StringUtils.isNotBlank;

public class SiteConversionConfigurationParser {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.asciidoctor.maven.site;

import java.util.Optional;

import org.asciidoctor.log.Severity;
import org.asciidoctor.maven.log.FailIf;
import org.asciidoctor.maven.log.LogHandler;
import org.codehaus.plexus.util.xml.Xpp3Dom;

import java.util.Optional;

public class SiteLogHandlerDeserializer {

public static final String NODE_NAME = "logHandler";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package org.asciidoctor.maven.commons;

import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;

import org.asciidoctor.Attributes;
import org.asciidoctor.AttributesBuilder;
import org.assertj.core.data.MapEntry;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;

import static org.asciidoctor.maven.commons.AsciidoctorHelper.addAttributes;
import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.asciidoctor.maven.log;

import java.io.File;
import java.io.IOException;

import org.asciidoctor.ast.Cursor;
import org.asciidoctor.log.LogRecord;
import org.asciidoctor.log.Severity;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import java.io.File;
import java.io.IOException;

import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package org.asciidoctor.maven.site;

import java.io.File;
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import org.apache.maven.model.Model;
import org.apache.maven.project.MavenProject;
import org.asciidoctor.Attributes;
Expand All @@ -9,13 +15,9 @@
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import static org.asciidoctor.Options.*;
import static org.asciidoctor.Options.ATTRIBUTES;
import static org.asciidoctor.Options.BASEDIR;
import static org.asciidoctor.Options.TEMPLATE_DIRS;
import static org.assertj.core.api.Assertions.assertThat;

class SiteConversionConfigurationParserTest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
package org.asciidoctor.maven;

import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.logging.Logger;

import org.apache.commons.io.FilenameUtils;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
Expand Down Expand Up @@ -30,20 +44,6 @@
import org.asciidoctor.maven.process.SourceDocumentFinder;
import org.jruby.Ruby;

import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.logging.Logger;

import static org.asciidoctor.maven.commons.StringUtils.isBlank;
import static org.asciidoctor.maven.commons.StringUtils.isNotBlank;
import static org.asciidoctor.maven.process.SourceDirectoryFinder.DEFAULT_SOURCE_DIR;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package org.asciidoctor.maven;

import java.io.File;
import java.io.FileFilter;
import java.util.Collection;
import java.util.Collections;
import java.util.Optional;
import java.util.Scanner;
import java.util.StringJoiner;

import org.apache.commons.io.filefilter.FileFilterUtils;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.apache.commons.io.filefilter.NameFileFilter;
Expand All @@ -17,14 +25,6 @@
import org.asciidoctor.maven.refresh.ResourcesPatternBuilder;
import org.asciidoctor.maven.refresh.TimeCounter;

import java.io.File;
import java.io.FileFilter;
import java.util.Collection;
import java.util.Collections;
import java.util.Optional;
import java.util.Scanner;
import java.util.StringJoiner;

import static org.asciidoctor.maven.commons.StringUtils.isNotBlank;
import static org.asciidoctor.maven.process.SourceDocumentFinder.CUSTOM_FILE_EXTENSIONS_PATTERN_PREFIX;
import static org.asciidoctor.maven.process.SourceDocumentFinder.CUSTOM_FILE_EXTENSIONS_PATTERN_SUFFIX;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.asciidoctor.maven;

import java.io.File;
import java.io.IOException;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
Expand All @@ -8,9 +11,6 @@
import org.apache.maven.project.MavenProjectHelper;
import org.asciidoctor.maven.io.Zips;

import java.io.File;
import java.io.IOException;

@Mojo(name = "zip")
public class AsciidoctorZipMojo extends AsciidoctorMojo {
public static final String PREFIX = AsciidoctorMaven.PREFIX + "zip.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package org.asciidoctor.maven.http;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.nio.charset.StandardCharsets;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFutureListener;
Expand All @@ -16,11 +21,6 @@
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.nio.charset.StandardCharsets;

public class AsciidoctorHandler extends SimpleChannelInboundHandler<FullHttpRequest> {

private static final String HTML_MEDIA_TYPE = "text/html";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package org.asciidoctor.maven.http;

import java.io.File;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelInitializer;
Expand All @@ -14,10 +18,6 @@
import io.netty.util.concurrent.Future;
import org.apache.maven.plugin.logging.Log;

import java.io.File;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger;

/**
* HTTP server to expose AsciiDoc converted sources.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.asciidoctor.maven.io;

import org.apache.commons.io.IOUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import org.apache.commons.io.IOUtils;

public final class Zips {

public static void zip(final File dir, final File zipName) throws IOException, IllegalArgumentException {
Expand Down
Loading

0 comments on commit d7e577a

Please sign in to comment.