Thank you for wanting to contribute to TASTy query!
We are looking for both code and documentation contributions, or perhaps your can report a bug.
You can contribute to TASTy Query by reading the steps in this document and making a pull request. Core maintainers will then read your contribution and offer constructive feedback and we will work with you to merge your contribution!
We also use a continuous integration (CI) system to automate some of the checking.
- You will need a GitHub account to make pull requests to this repository.
- You should be familiar with the code of conduct
The following tools can be installed following our Scala getting started guide:
A text editor is also useful, we recommend VS Code with the Metals IDE extension.
To test that everything is working, you can run the tests.
In a terminal, navigate to the directory of this project and start sbt
with the command:
$ sbt
[...]
sbt:root>
All the other commands in this document are assumed to be done within sbt
.
To run all the tests on the JVM:
sbt:root> tastyQueryJVM/test
[...]
[success] Total time: 5 s, completed Nov 2, 2022 2:31:15 PM
You can also test the JS version, assuming you have installed Node.js, with:
sbt:root> tastyQueryJS/test
[...]
[success] Total time: 8 s, completed Nov 2, 2022 2:32:35 PM
tasty-query/
: source code and tests for tasty-query itselfshared/src/main/
: main, portable sourcesshared/src/test
: test sourcesjvm/
: JVM-specific sources and testsjs/
: JS-specific sources and tests
test-sources/
: source files used as input in the test cases oftasty-query/
- First, read our issues to see if there is something already actionable, (labelled with
bug
,enhancement
,documentation
,good first issue
, orhelp wanted
) - If you are adding code, make sure to add tests that validate each code addition.
- Format the code.
We have several test suites to add to, depending on the contribution type:
ReadTreeSuite
: tests for reading specific kinds of TASTy treesTypeSuite
: tests about computing the types of symbols and treesSubtypingSuite
: tests abouttp1.isSubtype(tp2)
andtp1.isSameType(tp2)
PositionSuite
: tests for reading the positions (Spans
) of treesSignatureSuite
tests for thesignedName
of methods (and indirectly for the erasure of types)SymbolSuite
: tests for reaching symbols in an isolated way (this is probably not where you want to add tests)
Take inspiration from existing tests in the appropriate test suite to write your own.
We use Scalafmt to format our code, and pull requests are validated by CI to ensure that code is formatted correctly.
To format your code before making a PR, run Scalafmt with:
sbt:root> scalafmtAll
You can edit the config in the file .scalafmt.conf
We use sbt-ci-release and sbt-version-policy.
- Push a tag starting with
v
(e.g.,v1.2.3
) - After the release succeeds and the artifacts are publicly available, push a
commit to reset the compatibility intention in
build.sbt
:versionPolicyIntention := Compatibility.SourceAndBinaryCompatible
If you try to introduce a breaking change, the task versionPolicyCheck
fails
with a message like “Module xxx is not binary compatible with version x.y.z. You
have to relax your compatibility intention by changing the value of
versionPolicyIntention
”.
To fix the issue, configure the key versionPolicyIntention
according to the
nature of the breaking changes:
// to introduce a source incompatibility
versionPolicyIntention := Compatibility.BinaryCompatible
// or, to introduce a binary incompatibility
versionPolicyIntention := Compatibility.None