Skip to content

Commit

Permalink
master->main
Browse files Browse the repository at this point in the history
Closes gh-45
  • Loading branch information
rwinch committed Apr 26, 2021
1 parent c75cbc6 commit 61fa587
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
16 changes: 8 additions & 8 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ NOTE: You can read more about the background of this project in the https://spri

The project is split up into the following modules:

* https://github.com/spring-io/nohttp/tree/master/nohttp[nohttp] - the core project that allows finding and replacing `http://` URLs
* https://github.com/spring-io/nohttp/tree/master/nohttp-cli[nohttp-cli] - a thin wrapper around `nohttp` that allows running it from the command line
* https://github.com/spring-io/nohttp/tree/master/nohttp-checkstyle[nohttp-checkstyle] - provides https://checkstyle.org/[checkstyle] integration with nohttp
* https://github.com/spring-io/nohttp/tree/master/nohttp-gradle[nohttp-gradle] - provides https://gradle.org[Gradle] integration with nohttp
* https://github.com/spring-io/nohttp/tree/master/samples[samples] - provides samples of using nohttp
* https://github.com/spring-io/nohttp/tree/main/nohttp[nohttp] - the core project that allows finding and replacing `http://` URLs
* https://github.com/spring-io/nohttp/tree/main/nohttp-cli[nohttp-cli] - a thin wrapper around `nohttp` that allows running it from the command line
* https://github.com/spring-io/nohttp/tree/main/nohttp-checkstyle[nohttp-checkstyle] - provides https://checkstyle.org/[checkstyle] integration with nohttp
* https://github.com/spring-io/nohttp/tree/main/nohttp-gradle[nohttp-gradle] - provides https://gradle.org[Gradle] integration with nohttp
* https://github.com/spring-io/nohttp/tree/main/samples[samples] - provides samples of using nohttp

== FAQ

*How can I automate fixing my existing code?*

Automation is beyond the scope of this project. However, you can easily automate fixing your existing code by scripting along with https://github.com/spring-io/nohttp/tree/master/nohttp-cli[nohttp-cli]. If you use GitHub, you can leverage https://developer.github.com/v3/[GitHub APIs] to automatically clone repositories within a set of organizations. You can use https://github.com/github/hub[hub] to automate sending Pull Requests.
Automation is beyond the scope of this project. However, you can easily automate fixing your existing code by scripting along with https://github.com/spring-io/nohttp/tree/main/nohttp-cli[nohttp-cli]. If you use GitHub, you can leverage https://developer.github.com/v3/[GitHub APIs] to automatically clone repositories within a set of organizations. You can use https://github.com/github/hub[hub] to automate sending Pull Requests.

*What URLs need to be https?*

See https://github.com/spring-io/nohttp/tree/master/nohttp#thought-process[Thought Process]
See https://github.com/spring-io/nohttp/tree/main/nohttp#thought-process[Thought Process]

*Are Allow Lists Supported*

See https://github.com/spring-io/nohttp/tree/master/nohttp#allow-http-urls[Allow HTTP URLs]
See https://github.com/spring-io/nohttp/tree/main/nohttp#allow-http-urls[Allow HTTP URLs]
14 changes: 7 additions & 7 deletions nohttp-checkstyle/README.adoc
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
This project integrates https://github.com/spring-io/nohttp/tree/master/nohttp[nohttp] with https://checkstyle.org[checkstyle] to reject URLs with the `http://` scheme while ignoring URLs that cannot be `https://`.
This project integrates https://github.com/spring-io/nohttp/tree/main/nohttp[nohttp] with https://checkstyle.org[checkstyle] to reject URLs with the `http://` scheme while ignoring URLs that cannot be `https://`.

= NoHttpCheck

This verifies that your build has no `http://` URLs but ignores URLs that cannot be `https://`.

[NOTE]
====
If you are using https://gradle.org/[Gradle], see https://github.com/spring-io/nohttp/tree/master/nohttp-gradle[nohttp-gradle] project.
If you are using https://gradle.org/[Gradle], see https://github.com/spring-io/nohttp/tree/main/nohttp-gradle[nohttp-gradle] project.
====

While many checkstyle configurations only impact your source and resources, it is important that no http checks are performed on all the files within your repository.
For example, you will want to ensure that you validate your build files like `pom.xml` and `build.gradle`.

== Samples

* https://github.com/spring-io/nohttp/tree/master/samples/nohttp-gradle-sample[nohttp-gradle-sample] - Demonstrates using nohttp with Gradle
* https://github.com/spring-io/nohttp/tree/master/samples/nohttp-maven-sample[nohttp-maven-sample] - Demonstrates using nohttp with Maven
* https://github.com/spring-io/nohttp/tree/main/samples/nohttp-gradle-sample[nohttp-gradle-sample] - Demonstrates using nohttp with Gradle
* https://github.com/spring-io/nohttp/tree/main/samples/nohttp-maven-sample[nohttp-maven-sample] - Demonstrates using nohttp with Maven

== Configuration

Expand Down Expand Up @@ -53,13 +53,13 @@ NOTE: `SuppressWithPlainTextCommentFilter` was added in Checkstyle 8.6, so for t

=== Custom Allowlist

The nohttp project provides a https://github.com/spring-io/nohttp/tree/master/nohttp#allow-http-urls[default allowlist].
If you find the need to exclude additional URL patterns, you can do so with the above configuration by including a https://checkstyle.org/config.html#Properties[checkstyle property] named `nohttp.checkstyle.allowlistFileName` pointing to an allowlist file that is in the format of https://github.com/spring-io/nohttp/tree/master/nohttp#allow-http-urls[RegexPredicate.createAllowlist(InputStream)].
The nohttp project provides a https://github.com/spring-io/nohttp/tree/main/nohttp#allow-http-urls[default allowlist].
If you find the need to exclude additional URL patterns, you can do so with the above configuration by including a https://checkstyle.org/config.html#Properties[checkstyle property] named `nohttp.checkstyle.allowlistFileName` pointing to an allowlist file that is in the format of https://github.com/spring-io/nohttp/tree/main/nohttp#allow-http-urls[RegexPredicate.createAllowlist(InputStream)].

=== Embedding an Allowlist

If you prefer, you can embed an allowlist rather than externalizing it into a separate file by using the `allowlist` property.
The value of `allowlist` should be in the format of https://github.com/spring-io/nohttp/tree/master/nohttp#allow-http-urls[RegexPredicate.createAllowlist(InputStream)].
The value of `allowlist` should be in the format of https://github.com/spring-io/nohttp/tree/main/nohttp#allow-http-urls[RegexPredicate.createAllowlist(InputStream)].
For example, the following will allowlist `http://example.com` and `http://example.org`:

[source,xml]
Expand Down
2 changes: 1 addition & 1 deletion nohttp-cli/README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This is a utility for finding and replacing http URLs using https://github.com/spring-io/nohttp/tree/master/nohttp[nohttp].
This is a utility for finding and replacing http URLs using https://github.com/spring-io/nohttp/tree/main/nohttp[nohttp].
It takes into account which URLs are allowed by nohttp.

= Usage
Expand Down
18 changes: 9 additions & 9 deletions nohttp-gradle/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Applies <<NoHttpCheckstylePlugin>> and <<NoHttpCliPlugin>>

== Sample

You can find a working sample at https://github.com/spring-io/nohttp/tree/master/samples/nohttp-gradle-sample[nohttp-gradle-sample].
You can find a working sample at https://github.com/spring-io/nohttp/tree/main/samples/nohttp-gradle-sample[nohttp-gradle-sample].

== Usage

Expand Down Expand Up @@ -41,7 +41,7 @@ nohttp {

== NoHttpCheckstylePlugin

Configures Gradle's https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.Checkstyle.html[Checkstyle] task to integrate with https://github.com/spring-io/nohttp/tree/master/nohttp-checkstyle[nohttp-checkstyle] to verify there are no restricted usages of `http://`.
Configures Gradle's https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.Checkstyle.html[Checkstyle] task to integrate with https://github.com/spring-io/nohttp/tree/main/nohttp-checkstyle[nohttp-checkstyle] to verify there are no restricted usages of `http://`.

The plugin only needs to be added to the root project as all subdirectories are checked.

Expand Down Expand Up @@ -75,9 +75,9 @@ By default, the `NoHttpCheckstylePlugin` expects configuration files to be place
└── allowlist.lines // <4>
----
<1> Nohttp configuration files go here
<2> A custom checkstyle.xml file to use for `checkstyleNohttp`. The default can be found in the https://github.com/spring-io/nohttp/blob/master/nohttp-checkstyle/README.adoc#configuration[nohttp-checkstyle documentation]
<2> A custom checkstyle.xml file to use for `checkstyleNohttp`. The default can be found in the https://github.com/spring-io/nohttp/blob/main/nohttp-checkstyle/README.adoc#configuration[nohttp-checkstyle documentation]
<3> A suppressions file to use for `checkstyleNohttp`. The default is no suppressions
<4> https://github.com/spring-io/nohttp/tree/master/nohttp-checkstyle#custom-allowlist[Custom allowlist] to use
<4> https://github.com/spring-io/nohttp/tree/main/nohttp-checkstyle#custom-allowlist[Custom allowlist] to use

=== Dependency management

Expand All @@ -96,7 +96,7 @@ The nohttp plugin adds the following dependency configurations:

=== Configuration

The https://github.com/spring-io/nohttp/blob/master/nohttp-gradle/src/main/java/io/spring/nohttp/gradle/NoHttpExtension.java[NohttpExtension] is used to customize the configuration. An example configuration is:
The https://github.com/spring-io/nohttp/blob/main/nohttp-gradle/src/main/java/io/spring/nohttp/gradle/NoHttpExtension.java[NohttpExtension] is used to customize the configuration. An example configuration is:

[source,groovy]
----
Expand All @@ -107,7 +107,7 @@ nohttp {
}
----

<1> `allowlistFile` (https://docs.oracle.com/javase/8/docs/api/java/io/File.html[File]) - instructs nohttp to use `src/nohttp/allowlist.lines` to provide https://github.com/spring-io/nohttp/tree/master/nohttp#regexpredicatecreateallowlistinputstream[Custom Rules] for allowing HTTP URLs. Modifying the `allowlistFile` also modifies the default <<project-layout>> to look for the other configuration in the parent directory of `allowlistFile` (i.e. `src/nohttp`) as apposed to `config/nohttp`. This means if you have a file named `checkstyle.xml` in the same folder as `allowlistFile` you either need to include https://github.com/spring-io/nohttp/tree/master/nohttp-checkstyle#nohttpcheck[NoHttpCheck] in the file or you need to explicitly <<Configuring nohttpCheckstyle,configure nohttpCheckstyle task>> with a https://github.com/spring-io/nohttp/tree/master/nohttp-checkstyle#configuration[different checkstyle file].
<1> `allowlistFile` (https://docs.oracle.com/javase/8/docs/api/java/io/File.html[File]) - instructs nohttp to use `src/nohttp/allowlist.lines` to provide https://github.com/spring-io/nohttp/tree/main/nohttp#regexpredicatecreateallowlistinputstream[Custom Rules] for allowing HTTP URLs. Modifying the `allowlistFile` also modifies the default <<project-layout>> to look for the other configuration in the parent directory of `allowlistFile` (i.e. `src/nohttp`) as apposed to `config/nohttp`. This means if you have a file named `checkstyle.xml` in the same folder as `allowlistFile` you either need to include https://github.com/spring-io/nohttp/tree/master/nohttp-checkstyle#nohttpcheck[NoHttpCheck] in the file or you need to explicitly <<Configuring nohttpCheckstyle,configure nohttpCheckstyle task>> with a https://github.com/spring-io/nohttp/tree/master/nohttp-checkstyle#configuration[different checkstyle file].
<2> `source` (https://docs.gradle.org/current/userguide/working_with_files.html#sec:file_trees[FileTree]) - instructs nohttp what files to include / exclude. In this example, we exclude anything in the folder `test-output`.
<3> `toolVersion` - Updates the version of nohttp to use. The default is the same version as the nohttp Gradle Plugin version being used.

Expand All @@ -124,15 +124,15 @@ The `NoHttpCheckstylePlugin` defines:

== NoHttpCliPlugin

Adds a https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/JavaExec.html[JavaExec] task that allows running https://github.com/spring-io/nohttp/tree/master/nohttp-cli[nohttp-cli].
Adds a https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/JavaExec.html[JavaExec] task that allows running https://github.com/spring-io/nohttp/tree/main/nohttp-cli[nohttp-cli].

=== Tasks

The Application plugin adds the following tasks to the project.

`nohttp` — https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/JavaExec.html[JavaExec]::
+
Runs https://github.com/spring-io/nohttp/tree/master/nohttp-cli[nohttp-cli] against the project.
Runs https://github.com/spring-io/nohttp/tree/main/nohttp-cli[nohttp-cli] against the project.

=== nohttp samples

Expand All @@ -156,4 +156,4 @@ Advanced sample

- Exclude the folders 'build', `.git'
- Exclude the files 'spring.schemas`
- Use additional `allowlistFile` to provide https://github.com/spring-io/nohttp/tree/master/nohttp#regexpredicatecreateallowlistinputstream[Custom Rules] of `config/nohttp/allowlist.lines`
- Use additional `allowlistFile` to provide https://github.com/spring-io/nohttp/tree/main/nohttp#regexpredicatecreateallowlistinputstream[Custom Rules] of `config/nohttp/allowlist.lines`
4 changes: 2 additions & 2 deletions samples/README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Samples of using nohttp

* https://github.com/spring-io/nohttp/tree/master/samples/nohttp-gradle-sample[nohttp-gradle-sample] - Demos how to use nohttp with Gradle
* https://github.com/spring-io/nohttp/tree/master/samples/nohttp-maven-sample[nohttp-maven-sample] - Demos how to use nohttp with Maven
* https://github.com/spring-io/nohttp/tree/main/samples/nohttp-gradle-sample[nohttp-gradle-sample] - Demos how to use nohttp with Gradle
* https://github.com/spring-io/nohttp/tree/main/samples/nohttp-maven-sample[nohttp-maven-sample] - Demos how to use nohttp with Maven
2 changes: 1 addition & 1 deletion samples/nohttp-gradle-sample/README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Demo of using nohttp checkstyle with Gradle using https://github.com/spring-io/nohttp/tree/master/nohttp-gradle[nohttp-gradle]. Run the following
Demo of using nohttp checkstyle with Gradle using https://github.com/spring-io/nohttp/tree/main/nohttp-gradle[nohttp-gradle]. Run the following

[source,bash]
----
Expand Down
2 changes: 1 addition & 1 deletion samples/nohttp-maven-sample/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Demo of using nohttp checkstyle with Maven. Run the following

Try editing `has-url.txt` to contain an http URL and see the build fail.

For detailed checkstyle configuration, see https://github.com/spring-io/nohttp/tree/master/nohttp-checkstyle
For detailed checkstyle configuration, see https://github.com/spring-io/nohttp/tree/main/nohttp-checkstyle
2 changes: 1 addition & 1 deletion samples/nohttp-maven-sample/nohttp-checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<property name="charset" value="UTF-8"/>
<!-- Configure checker to run on files with these extensions -->
<property name="fileExtensions" value=""/>
<!-- For detailed checkstyle configuration, see https://github.com/spring-io/nohttp/tree/master/nohttp-checkstyle -->
<!-- For detailed checkstyle configuration, see https://github.com/spring-io/nohttp/tree/main/nohttp-checkstyle -->
<module name="io.spring.nohttp.checkstyle.check.NoHttpCheck">
</module>
</module>

0 comments on commit 61fa587

Please sign in to comment.