Update Code Q integrations (#276)

* Update Code Q integrations

* Code Q improvements (#277)
This commit is contained in:
Oleg Shur 2021-03-18 13:07:04 +03:00 committed by GitHub
parent 3cab34dca7
commit c908ae6967
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 37 additions and 71 deletions

View file

@ -1,12 +1,8 @@
name: backend name: backend
on: on:
pull_request: pull_request:
branches: paths-ignore:
- "master" - 'kafka-ui-react-app/**'
push:
branches:
- "**"
- "!master"
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -33,4 +29,4 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar

View file

@ -28,7 +28,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
language: [ 'java', 'javascript' ] language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more: # Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

View file

@ -1,29 +1,24 @@
name: frontend name: frontend
on: on:
pull_request: pull_request:
branches: paths:
- "master" - './kafka-ui-contract/**'
push: - './kafka-ui-react-app/**'
branches:
- "**"
- "!master"
jobs: jobs:
npm-test: npm-test:
needs: [mvn-contract-build]
env: env:
CI: true CI: true
NODE_ENV: dev NODE_ENV: dev
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Use Node.js - name: Use Node.js
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: "14" node-version: "14"
- uses: actions/download-artifact@v2
with:
name: generated-sources
path: kafka-ui-react-app/src/generated-sources
- name: Cache node dependency - name: Cache node dependency
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
@ -35,6 +30,10 @@ jobs:
run: | run: |
cd kafka-ui-react-app/ cd kafka-ui-react-app/
npm install npm install
- name: Generate sources
run: |
cd kafka-ui-react-app/
npm run gen:sources
- name: Linter - name: Linter
run: | run: |
cd kafka-ui-react-app/ cd kafka-ui-react-app/
@ -43,28 +42,10 @@ jobs:
run: | run: |
cd kafka-ui-react-app/ cd kafka-ui-react-app/
npm run test npm run test
- name: SonarCloud Scan
mvn-contract-build: uses: workshur/sonarcloud-github-action@improved_basedir
runs-on: ubuntu-latest
steps:
- name: Cache local Maven repository
uses: actions/cache@v1
with: with:
path: ~/.m2/repository projectBaseDir: ./kafka-ui-react-app
key: ${{ runner.os }}-maven-contract-${{ hashFiles('**/pom.xml') }} env:
restore-keys: | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
${{ runner.os }}-maven-contract- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_FRONTEND }}
${{ runner.os }}-maven-
- uses: actions/checkout@v2
- name: Set up JDK 1.13
uses: actions/setup-java@v1
with:
java-version: 1.13
- name: Build with Maven
run: |
cd kafka-ui-contract
mvn clean package
- uses: actions/upload-artifact@v2
with:
name: generated-sources
path: kafka-ui-contract/target/generated-sources/frontend

View file

@ -0,0 +1,4 @@
sonar.projectKey=provectus_kafka-ui_frontend
sonar.organization=provectus
sonar.sources=./src

View file

@ -33,7 +33,7 @@ const LatestVersionItem: React.FC<LatestVersionProps> = ({
</div> </div>
<div className="tile is-parent"> <div className="tile is-parent">
<div className="tile is-child box py-1"> <div className="tile is-child box py-1">
<JSONViewer data={JSON.parse(schema as string)} /> <JSONViewer data={JSON.parse(schema)} />
</div> </div>
</div> </div>
</div> </div>

View file

@ -14,7 +14,7 @@ const SchemaVersion: React.FC<SchemaVersionProps> = ({
<td>{version}</td> <td>{version}</td>
<td>{id}</td> <td>{id}</td>
<td className="py-0"> <td className="py-0">
<JSONViewer data={JSON.parse(schema as string)} /> <JSONViewer data={JSON.parse(schema)} />
</td> </td>
</tr> </tr>
); );

View file

@ -57,15 +57,14 @@ const List: React.FC<ListProps> = ({
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{schemas.length > 0 ? ( {schemas.length === 0 && (
schemas.map((subject) => (
<ListItem key={subject.id} subject={subject} />
))
) : (
<tr> <tr>
<td colSpan={10}>No schemas found</td> <td colSpan={10}>No schemas found</td>
</tr> </tr>
)} )}
{schemas.map((subject) => (
<ListItem key={subject.id} subject={subject} />
))}
</tbody> </tbody>
</table> </table>
</div> </div>

View file

@ -12,7 +12,7 @@ export interface NewProps {
createSchema: ( createSchema: (
clusterName: ClusterName, clusterName: ClusterName,
newSchemaSubject: NewSchemaSubject newSchemaSubject: NewSchemaSubject
) => void; ) => Promise<void>;
} }
const New: React.FC<NewProps> = ({ createSchema }) => { const New: React.FC<NewProps> = ({ createSchema }) => {

View file

@ -85,15 +85,14 @@ const List: React.FC<Props> = ({
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{items.length > 0 ? ( {items.length === 0 && (
items.map((topic) => (
<ListItem key={topic.name} topic={topic} />
))
) : (
<tr> <tr>
<td colSpan={10}>No topics found</td> <td colSpan={10}>No topics found</td>
</tr> </tr>
)} )}
{items.map((topic) => (
<ListItem key={topic.name} topic={topic} />
))}
</tbody> </tbody>
</table> </table>
<Pagination totalPages={totalPages} /> <Pagination totalPages={totalPages} />

View file

@ -7,11 +7,10 @@ import {
TopicFormDataRaw, TopicFormDataRaw,
} from 'redux/interfaces'; } from 'redux/interfaces';
import { withRouter, RouteComponentProps } from 'react-router-dom'; import { withRouter, RouteComponentProps } from 'react-router-dom';
import { createTopic } from 'redux/actions'; import { createTopic, createTopicAction } from 'redux/actions';
import { getTopicCreated } from 'redux/reducers/topics/selectors'; import { getTopicCreated } from 'redux/reducers/topics/selectors';
import { clusterTopicPath } from 'lib/paths'; import { clusterTopicPath } from 'lib/paths';
import { ThunkDispatch } from 'redux-thunk'; import { ThunkDispatch } from 'redux-thunk';
import * as actions from 'redux/actions';
import New from './New'; import New from './New';
interface RouteProps { interface RouteProps {
@ -42,7 +41,7 @@ const mapDispatchToProps = (
redirectToTopicPath: (clusterName: ClusterName, topicName: TopicName) => { redirectToTopicPath: (clusterName: ClusterName, topicName: TopicName) => {
history.push(clusterTopicPath(clusterName, topicName)); history.push(clusterTopicPath(clusterName, topicName));
}, },
resetUploadedState: () => dispatch(actions.createTopicAction.failure()), resetUploadedState: () => dispatch(createTopicAction.failure()),
}); });
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(New)); export default withRouter(connect(mapStateToProps, mapDispatchToProps)(New));

View file

@ -1,12 +0,0 @@
sonar.projectKey=provectus_kafka-ui
sonar.organization=provectus
# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=kafka-ui
#sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8