RULEAPI-583 Add a link from the frontend to Github PRs adding rules
This commit is contained in:
parent
19d237ce18
commit
80d3da511c
26
README.adoc
26
README.adoc
@ -28,6 +28,9 @@ include::supported_languages.adoc[]
|
||||
Go to the https://sonarsource.github.io/rspec/#/[Search Page] to find the rules that have already been merged in the `master` branch.
|
||||
|
||||
Go the the GitHub https://github.com/SonarSource/rspec/pulls[pull-request] tab to find the rules that have not been merged yet.
|
||||
You can use the "Search in unimplemented" link on the Search Page to repeat your search in the PRs.
|
||||
|
||||
WARNING: Unlike the Search Page, the GitHub search across the PRs for unimplemented rules considers only the PR summary and title. It does not search the content of the proposed rule (i.e. it does not look into `rule.adoc` nor into `metadata.json`).
|
||||
|
||||
== Create or modify a rule
|
||||
|
||||
@ -50,10 +53,15 @@ image::img/new-rule-workflow.png[]
|
||||
==== To modify an existing rule
|
||||
Create a branch for your modifications manually.
|
||||
Then open a pull request manually.
|
||||
In the subject add the following text:
|
||||
The subject must start with the following required prefix:
|
||||
----
|
||||
Modify rule Sxxxx
|
||||
----
|
||||
Add a short summary of the PR after the required prefix. For example:
|
||||
----
|
||||
Modify rule S1234: Allow tail recursion for languages supporting TCO
|
||||
----
|
||||
|
||||
|
||||
==== To deprecate a rule
|
||||
Create a branch for the deprecation manually.
|
||||
@ -74,9 +82,23 @@ NOTE: use a GitHub hot-key `t` in the source view to navigate to an existing rul
|
||||
|
||||
=== 2. Edit the pull request
|
||||
|
||||
You should see https://github.com/pulls/assigned[a new pull request assigned to you]. It might take up to a minute to appear.
|
||||
You should see https://github.com/pulls/assigned[a new pull request assigned to you]. It might take up to a few minutes to appear.
|
||||
It contains a scaffolding of files for the new rule. Feel free to modify it as you please.
|
||||
|
||||
The title of the PR for a new rule will say only "Create rule Sxxxx", which is not very informative.
|
||||
|
||||
Modify the title to better summarize the nature or the rule, so that it is easier to find when searching through unimplemented rules.
|
||||
Do preserve the "Create rule Sxxxx" prefix, as it is used by our tooling.
|
||||
For example:
|
||||
|
||||
----
|
||||
Create rule S7028: All identifiers should be in CamelCase
|
||||
----
|
||||
|
||||
Add the description of the PR to further increase its discoverability
|
||||
(GitHub PR search does not see the `rule.adoc`).
|
||||
To do that, click on the three dots (next to the smile) on the first comment (created by github-actions bot) and select "Edit".
|
||||
|
||||
The rule must contain subdirectories corresponding to all the languages this rule is implemented for.
|
||||
|
||||
Each language subdirectory contains the `rule.adoc` that is the root document used to render the specification.
|
||||
|
@ -16,6 +16,11 @@ export default makeStyles((theme) => ({
|
||||
searchResults: {
|
||||
marginTop: theme.spacing(3),
|
||||
},
|
||||
topRow: {
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between'
|
||||
},
|
||||
resultsCount: {
|
||||
marginBottom: theme.spacing(2),
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import Container from '@material-ui/core/Container';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import Pagination from '@material-ui/lab/Pagination';
|
||||
import Box from '@material-ui/core/Box';
|
||||
import Button from '@material-ui/core/Button';
|
||||
|
||||
import useStyles from './SearchPage.style';
|
||||
import { useSearch } from './utils/useSearch';
|
||||
@ -146,8 +147,13 @@ export const SearchPage = () => {
|
||||
<Container maxWidth="md">
|
||||
<Grid container spacing={3}>
|
||||
<Grid item xs={12}>
|
||||
<Box className={classes.resultsCount}>
|
||||
<Typography variant="subtitle1">Number of rules found: {numberOfHits}</Typography>
|
||||
<Box className={classes.topRow}>
|
||||
<Box className={classes.resultsCount}>
|
||||
<Typography variant="subtitle1">Number of rules found: {numberOfHits}</Typography>
|
||||
</Box>
|
||||
<Typography variant="subtitle1">
|
||||
<a href={"https://github.com/SonarSource/rspec/pulls?q=is%3Aopen+is%3Apr+%22Create+rule%22+" + query}>Search in unimplemented</a>
|
||||
</Typography>
|
||||
</Box>
|
||||
{resultsDisplay}
|
||||
<Pagination count={totalPages} page={pageNumber} siblingCount={2}
|
||||
|
@ -3,6 +3,7 @@ import AppBar from '@material-ui/core/AppBar';
|
||||
import Toolbar from '@material-ui/core/Toolbar';
|
||||
import Typography from '@material-ui/core/Typography';
|
||||
import IconButton from '@material-ui/core/IconButton';
|
||||
import Button from '@material-ui/core/Button';
|
||||
import MenuIcon from '@material-ui/icons/Menu';
|
||||
|
||||
import useStyles from './TopBar.style';
|
||||
@ -19,6 +20,11 @@ export default function TopBar() {
|
||||
<Typography variant="h6" className={classes.title}>
|
||||
SonarSource Rule Specifications
|
||||
</Typography>
|
||||
<a href="https://github.com/SonarSource/rspec/pulls?q=is%3Aopen+is%3Apr+%22Create+rule%22">
|
||||
<Button>
|
||||
<span> Unimplemented rules </span>
|
||||
</Button>
|
||||
</a>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user