Skip to content

Commit 202ca3c

Browse files
committed
Add a Markdown linter to check validation tasks
I would rather use Spotless for these checks, for consistency with other format checkers that we already use. [Spotless supports Markdown via flexmark](https://github.com/diffplug/spotless/tree/main/plugin-gradle#flexmark), but unfortunately [Spotless does not provide access to any of flexmark's configuration options](diffplug/spotless#2183). That would leave us with a Markdown linter that is too lenient for my tastes. For example, [Spotless's flexmark configuration does not even restrict maximum line length](diffplug/spotless#2167). Resolves #818.
1 parent 3e7322d commit 202ca3c

File tree

5 files changed

+68
-48
lines changed

5 files changed

+68
-48
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Beyond tests, other checks run as part of `./gradlew check` and
2626

2727
1. Compilation with the Java compiler from [Eclipse JDT
2828
Core](https://www.eclipse.org/jdt/core/), which runs additional
29-
lint checks
29+
Lint checks
3030

3131
1. Checking that all Java and Kotlin code is formatted according to
3232
[Google Java Format](https://github.com/google/google-java-format)

README-Gradle.md

+35-37
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
# WALA’s Gradle Build System
2+
13
This document describes some WALA-specific aspects of our Gradle build
24
system, plus a few general Gradle features that may be of particular
35
interest to WALA developers. However, it is not a Gradle tutorial.
46

5-
# Getting Started
7+
## Getting Started
68

7-
## External Dependencies: Patience is a Virtue
9+
### External Dependencies: Patience is a Virtue
810

911
Gradle downloads many packages and supporting Java libraries as
1012
needed. Your first Gradle build may take a long time. On a fast
@@ -17,32 +19,31 @@ faster. Rerunning `./gradlew assemble processTestResources` with a
1719
warm cache in an already-built tree takes under three seconds.
1820

1921
WALA components are built using a mix of Java 11 and Java 17. Gradle
20-
will [download suitable JDKs
21-
automatically](https://docs.gradle.org/current/userguide/toolchains.html#sec:provisioning)
22-
if they are not already [locally
23-
installed](https://docs.gradle.org/current/userguide/toolchains.html#sec:auto_detection)
22+
will
23+
[download suitable JDKs automatically](https://docs.gradle.org/current/userguide/toolchains.html#sec:provisioning)
24+
if they are not already
25+
[locally installed](https://docs.gradle.org/current/userguide/toolchains.html#sec:auto_detection)
2426
or
2527
[custom-configured](https://docs.gradle.org/current/userguide/toolchains.html#sec:custom_loc).
2628

27-
## Eclipse
29+
### Eclipse
2830

29-
### One-Time Eclipse Configuration
31+
#### One-Time Eclipse Configuration
3032

3133
To work with WALA inside Eclipse, first **install Eclipse Buildship
32-
3.1 or later** using either [the Eclipse
33-
Marketplace](http://www.vogella.com/tutorials/EclipseGradle/article.html#installation-via-the-marketplace)
34-
or [the Eclipse update
35-
manager](http://www.vogella.com/tutorials/EclipseGradle/article.html#installation-via-the-eclipse-update-manager).
34+
3.1 or later** using either
35+
[the Eclipse Marketplace](http://www.vogella.com/tutorials/EclipseGradle/article.html#installation-via-the-marketplace)
36+
or
37+
[the Eclipse update manager](http://www.vogella.com/tutorials/EclipseGradle/article.html#installation-via-the-eclipse-update-manager).
3638
Buildship integrates Eclipse with Gradle, much like how M2Eclipse
3739
integrates Eclipse with Maven. Restart Eclipse after installing this
3840
feature.
3941

40-
### Importing WALA Projects Into Eclipse
42+
#### Importing WALA Projects Into Eclipse
4143

42-
Once you are running a Buildship-enabled Eclipse, **[use the “Existing
43-
Gradle Project” import
44-
wizard](http://www.vogella.com/tutorials/EclipseGradle/article.html#import-an-existing-gradle-project)
45-
to import WALA into Eclipse.** Select and import the topmost level of
44+
Once you are running a Buildship-enabled Eclipse,
45+
[use the “Existing Gradle Project” import wizard](http://www.vogella.com/tutorials/EclipseGradle/article.html#import-an-existing-gradle-project)
46+
to import WALA into Eclipse. Select and import the topmost level of
4647
your WALA source tree. On the “Import Options” page of the import
4748
wizard, leave all settings at their defaults: the “Override workspace
4849
settings” option should be off, and the grayed-out “Gradle
@@ -67,15 +68,14 @@ connection.
6768

6869
Note: a pristine WALA source tree is *not* pre-configured as a group
6970
of Eclipse projects. Using the standard Eclipse “Existing Projects
70-
into Workspace” import wizard will not work correctly. You must [use
71-
the “Existing Gradle Project” import
72-
wizard](http://www.vogella.com/tutorials/EclipseGradle/article.html#import-an-existing-gradle-project)
71+
into Workspace” import wizard will not work correctly. You must
72+
[use the “Existing Gradle Project” import wizard](http://www.vogella.com/tutorials/EclipseGradle/article.html#import-an-existing-gradle-project)
7373
instead.
7474

75-
### `.classpath` and `.project` as Generated Files
75+
#### `.classpath` and `.project` as Generated Files
7676

7777
You will find no `.classpath` or `.project` files anywhere in [the
78-
Gradle fork of WALA’s git repository](https://github.com/liblit/WALA).
78+
Gradle fork of WALA’s Git repository](https://github.com/liblit/WALA).
7979
Importing using the “Existing Gradle Project” wizard creates these
8080
Eclipse project configuration files automatically based on the
8181
underlying Gradle configuration.
@@ -96,9 +96,9 @@ plugin](https://docs.gradle.org/current/userguide/eclipse_plugin.html).
9696
A few WALA sub-projects already use this: look for `eclipse.project`
9797
in `*/build.gradle.kt` for examples.
9898

99-
## IntelliJ IDEA
99+
### IntelliJ IDEA
100100

101-
### Opening WALA in IntelliJ IDEA
101+
#### Opening WALA in IntelliJ IDEA
102102

103103
Open the top-level WALA directory as a project; it should have a
104104
distinctive badge on its folder icon marking it as a directory
@@ -115,7 +115,7 @@ patient](#external-dependencies-patience-is-a-virtue) during the
115115
initial project open, especially if you have a slow network
116116
connection.
117117

118-
### Benign Warning About Non-Managed Maven Project
118+
#### Benign Warning About Non-Managed Maven Project
119119

120120
Each time you open the WALA project, IntelliJ IDEA may report
121121
“Non-managed pom.xml file found” in its event log. This arises
@@ -125,7 +125,7 @@ safely ignore this notification, permanently disable it using the
125125
offered “Disable notification” link, or even disable the IntelliJ IDEA
126126
Maven plugin entirely if you have no other need for it.
127127

128-
### Project Configuration as Derived Model
128+
#### Project Configuration as Derived Model
129129

130130
IntelliJ IDEA automatically derives its project models from the Gradle
131131
build configuration, including all information about both internal and
@@ -142,7 +142,7 @@ to change module and library settings is to change the Gradle
142142
configuration such that the *derived* IntelliJ IDEA model is what you
143143
want it to be.
144144

145-
## Gradle Command Line
145+
### Gradle Command Line
146146

147147
You do not need to install Gradle separately. **WALA includes its own
148148
copy of Gradle, available as the `gradlew` script in the top-level
@@ -156,7 +156,7 @@ under `*/build`. For example the jar archives created by the
156156
that Eclipse-generated artifacts will appear in Eclipse-specific
157157
places, such as `*/bin` and `*/target`.
158158

159-
### Trustworthy Dependencies For Incremental Builds
159+
#### Trustworthy Dependencies For Incremental Builds
160160

161161
Gradle has excellent understanding of task and file dependencies. You
162162
can trust it to perform incremental rebuilds rather than always
@@ -165,7 +165,7 @@ and rebuilding from scratch after every change, I recommend that you
165165
drop `clean` as a reflexive extra step and **trust Gradle to do
166166
incremental builds correctly.**
167167

168-
### Favorite Build Tasks
168+
#### Favorite Build Tasks
169169

170170
Some useful Gradle tasks include:
171171

@@ -182,7 +182,7 @@ Some useful Gradle tasks include:
182182

183183
- `clean`: remove all Gradle-generated artifacts
184184

185-
### Tasks in Specific Sub-Projects
185+
#### Tasks in Specific Sub-Projects
186186

187187
When you run `./gradlew` in the top-level WALA directory, any tasks
188188
you list will be built in all sub-projects. For example, `./gradlew
@@ -198,15 +198,14 @@ want to build tasks only in specific sub-projects, you have two options:
198198
and then run `../gradlew assemble`. Note the proper relative path
199199
to the top-level Gradle script: `../gradle` instead of `./gradlew`.
200200

201-
### Task Name Abbreviation
201+
#### Task Name Abbreviation
202202

203-
[Any build task can be
204-
abbreviated](https://docs.gradle.org/current/userguide/command_line_interface.html#_task_name_abbreviation)
203+
[Any build task can be abbreviated](https://docs.gradle.org/current/userguide/command_line_interface.html#_task_name_abbreviation)
205204
by shortening each camel-case-delimited word in its name. For
206205
example, the `processTestResources` task can probably be abbreviated
207206
as `procTeRes` or even `pTR`.
208207

209-
### Useful Command-Line Flags
208+
#### Useful Command-Line Flags
210209

211210
Among Gradle’s command-line flags, I have found the following
212211
particularly useful:
@@ -217,8 +216,7 @@ particularly useful:
217216
see multiple test failures rather than giving up after the first
218217
failure.
219218

220-
- [`-t`,
221-
`--continuous`](https://docs.gradle.org/current/userguide/command_line_interface.html#_continuous_build):
219+
- [`-t`, `--continuous`](https://docs.gradle.org/current/userguide/command_line_interface.html#_continuous_build):
222220
keep Gradle process running and re-execute the given tasks whenever
223221
input files change. Similar to Eclipse’s behavior of updating the
224222
build whenever you change and save a file.
@@ -236,7 +234,7 @@ particularly useful:
236234
good way to gain insights into why Gradle did what it did, and how
237235
long each piece took.
238236

239-
### Composite Builds
237+
#### Composite Builds
240238

241239
Gradle’s [composite
242240
builds](https://docs.gradle.org/current/userguide/composite_builds.html)

README.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
# WALA
2+
13
![WALA logo](https://wala.github.io/logos/WALA-banner.png)
24

3-
[![GitHub Actions
4-
status](https://github.com/wala/WALA/workflows/Continuous%20integration/badge.svg)](https://github.com/wala/WALA/actions?query=workflow%3A%22Continuous+integration%22)
5-
[![Join the chat at
6-
https://gitter.im/WALAHelp/Lobby](https://badges.gitter.im/WALAHelp/Lobby.svg)](https://gitter.im/WALAHelp/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5+
[![GitHub Actions status](https://github.com/wala/WALA/workflows/Continuous%20integration/badge.svg)](https://github.com/wala/WALA/actions?query=workflow%3A%22Continuous+integration%22)
6+
[![Join the chat at https://gitter.im/WALAHelp/Lobby](https://badges.gitter.im/WALAHelp/Lobby.svg)](https://gitter.im/WALAHelp/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
77

8-
-------------------------
8+
---
99

1010
The T. J. Watson Libraries for Analysis (WALA) provide static analysis
1111
capabilities for Java bytecode and related languages and for
@@ -46,8 +46,7 @@ technical documentation. In the meantime, you can check out tutorial
4646
slides to get an overview of WALA:
4747

4848
* [Core WALA](https://wala.github.io/tutorials/PLDI_WALA_Tutorial.pdf) (PDF)
49-
* [WALA
50-
JavaScript](https://wala.github.io/tutorials/WALAJavaScriptTutorial.pdf)
49+
* [WALA JavaScript](https://wala.github.io/tutorials/WALAJavaScriptTutorial.pdf)
5150
(PDF)
5251

5352
You can also watch screencasts of the WALA JavaScript tutorial [here](https://www.youtube.com/user/WALALibraries/videos).
@@ -60,7 +59,7 @@ graph"](https://github.com/wala/WALA/search?q=call+graph&type=wikis).
6059

6160
We're hosting documentation for WALA on [the GitHub
6261
wiki](https://github.com/wala/WALA/wiki). **We've chosen a wiki
63-
format just so that _you_ can contribute.** Don't be shy!
62+
format just so that *you* can contribute.** Don't be shy!
6463

6564
The WALA publications department is populating this wiki with
6665
technical documentation on a demand-driven basis, driven by questions
@@ -117,4 +116,7 @@ page.
117116

118117
![YourKit logo](https://www.yourkit.com/images/yklogo.png)
119118

120-
We thank [YourKit](https://www.yourkit.com) for providing WALA developers with a complimentary license for their excellent [Java profiler](https://www.yourkit.com/java/profiler/), which we use to improve and maintain WALA performance.
119+
We thank [YourKit](https://www.yourkit.com) for providing WALA developers with
120+
a complimentary license for their excellent
121+
[Java profiler](https://www.yourkit.com/java/profiler/), which we use to
122+
improve and maintain WALA performance.

build.gradle.kts

+20-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
// plugin configuration must precede everything else
44
//
55

6+
import com.appmattus.markdown.rules.ConsistentHeaderStyleRule
7+
import com.appmattus.markdown.rules.ConsistentUlStyleRule
8+
import com.appmattus.markdown.rules.LowerCaseFilenameRule
9+
import com.appmattus.markdown.rules.config.HeaderStyle
10+
import com.appmattus.markdown.rules.config.UnorderedListStyle
611
import com.diffplug.gradle.pde.EclipseRelease
712
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
813

@@ -13,6 +18,7 @@ plugins {
1318
java
1419
alias(libs.plugins.dependency.analysis)
1520
alias(libs.plugins.file.lister)
21+
alias(libs.plugins.markdown)
1622
alias(libs.plugins.shellcheck)
1723
alias(libs.plugins.task.tree)
1824
alias(libs.plugins.version.catalog.update)
@@ -101,7 +107,20 @@ shellcheck {
101107
}
102108
}
103109

104-
tasks.named("check") { dependsOn("buildHealth") }
110+
// Markdown
111+
markdownlint {
112+
rules {
113+
+ConsistentHeaderStyleRule(HeaderStyle.Consistent)
114+
+ConsistentUlStyleRule(UnorderedListStyle.Consistent)
115+
+LowerCaseFilenameRule { excludes = listOf(".*/README-Gradle.md") }
116+
}
117+
}
118+
119+
tasks.named("markdownlint") {
120+
notCompatibleWithConfigurationCache("https://github.com/appmattus/markdown-lint/issues/39")
121+
}
122+
123+
tasks.named("check") { dependsOn("buildHealth", "markdownlint") }
105124

106125
tasks.named("shellcheck") { group = "verification" }
107126

gradle/libs.versions.toml

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ dependency-analysis = "com.autonomousapps.dependency-analysis:1.32.0"
4848
file-lister = "all.shared.gradle.file-lister:1.0.2"
4949
google-java-format = "com.github.sherter.google-java-format:0.9"
5050
ktfmt = "com.ncorti.ktfmt.gradle:0.18.0"
51+
markdown = "com.appmattus.markdown:0.6.0"
5152
shellcheck = "com.felipefzdz.gradle.shellcheck:1.4.6"
5253
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
5354
task-tree = "com.dorongold.task-tree:3.0.0"

0 commit comments

Comments
 (0)