Skip to content

Commit

Permalink
Merge pull request #48 from CMU-17313Q/plato-analysis-tool
Browse files Browse the repository at this point in the history
Integrated Plato - static analysis tool
  • Loading branch information
ssaloos authored Oct 23, 2023
2 parents 395019b + bfcd614 commit e5e8bc3
Show file tree
Hide file tree
Showing 65 changed files with 17,791 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ test/files
/public/src/modules/ace-editor.js
/public/src/client/account/header.js
/public/src/client/test.js
themes/
themes/

report/
83 changes: 83 additions & 0 deletions .github/workflows/plato.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Plato

on:
pull_request:
branches:
- main

defaults:
run:
shell: bash

permissions:
contents: read

jobs:
plato1:
permissions:
checks: write
contents: read
name: Plato
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [16]
runs-on: ${{ matrix.os }}
env:
TEST_ENV: ${{ matrix.test_env || 'production' }}

services:
mongo:
image: "mongo:3.7"
ports:
# Maps port 27017 on service container to the host
- 27017:27017

steps:
- uses: actions/checkout@v3

- run: cp install/package.json package.json

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: NPM Install
uses: bahmutov/npm-install@v1
with:
useLockFile: false

- name: Setup on MongoDB
env:
SETUP: >-
{
"url": "http://127.0.0.1:4567",
"secret": "abcdef",
"admin:username": "admin",
"admin:email": "[email protected]",
"admin:password": "hAN3Eg8W",
"admin:password:confirm": "hAN3Eg8W",
"database": "mongo",
"mongo:host": "127.0.0.1",
"mongo:port": 27017,
"mongo:username": "",
"mongo:password": "",
"mongo:database": "nodebb"
}
CI: >-
{
"host": "127.0.0.1",
"port": 27017,
"database": "ci_test"
}
run: |
node app --setup="${SETUP}" --ci="${CI}"
- name: Install Plato
run: npm install -g plato

- name: Run Plato Tool
run: plato -r -d report public/src/client/topic/postTools.js
1 change: 0 additions & 1 deletion create_config.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ json_data=$(jq --arg password "$REDIS_PASSWORD" '.redis.password = $password' <<
echo "$json_data" > "/usr/src/app/config.json"

cat /usr/src/app/config.json

2 changes: 2 additions & 0 deletions report/assets/css/morris.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 88 additions & 0 deletions report/assets/css/plato-display.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

body {
background: #222222;
margin: 20px;
}

.reportBlock {
background: #34495e;
color: #ecf0f1;
height: 300px;
position: relative;
}

.chart {
width: 100%;
height: 300px;
position: absolute;
top: 0; left: 0;
z-index: 0;
}

.reportContent {
z-index: 10;
position: absolute;
top: 0; left: 0;
width: 100%;
}

h2.reportTitle {
position: absolute;
top: 0;
left: 0;
color: #7F8181;
font-size: 14px;
font-weight: 200;
padding: 10px;
margin: 0;
text-transform: uppercase;
letter-spacing: 1px;
}

.reportBlock.lineCount { background-color: #272727; }
.reportBlock.maintainability { background-color: #272727; }
.reportBlock.maintainabilityList,
.reportBlock.locList,
.reportBlock.lintList {
background-color: #2A2A2A;
margin-top: 15px;
padding: 20px 5px;
}

.reportBlock .chart-label {
display: block;
padding-top: 100px;
text-align: center;
color: #7F8181;
font-size: 14px;
font-weight: 200;
text-transform: uppercase;
letter-spacing: 1px;
}

.reportBlock strong {
display: block;
font-size: 90%;
}

.reportBlock li {
border-bottom: 1px solid #323232;
}

.reportBlock h1 {
margin: 0;
font-size: 60px;
text-align: center;
}

.reportBlock ul {
margin: 15px !important;
}
.reportBlock h3 {
margin: 5px 15px 0;
}

.reportBlock li {
line-height: 22px;
font-size: 16px;
}
88 changes: 88 additions & 0 deletions report/assets/css/plato-file.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
.historical .chart {
height: 200px;
}

.CodeMirror {
height: auto;
}

.CodeMirror-scroll {
overflow-x: hidden;
overflow-y: hidden;
}
.CodeMirror-lines {
cursor:default;
}

.plato-mark {
background-color:rgb(212, 250, 236);
border: 1px dashed red;
border-width:1px 0 1px 0;
cursor:pointer;
}

.plato-mark.focus {
background-color: rgb(235, 250, 166);
}
.plato-mark.active {
background-color: rgb(158, 180, 255);
}

.plato-mark-start {
border-left-width:1px;
padding-left:1px;
}
.plato-mark-end {
border-right-width:1px;
padding-right:1px;
}
.plato-gutter {
}

.plato-gutter-icon {
font-size:16px;
cursor:pointer;
color: #800000;
text-align:center;
}

.plato-gutter-jshint, .plato-gutter-complexity {
width:14px;
}

.charts {
margin-top:1em;
}

.charts .header {
font-weight:normal;
text-align:center;
}

.chart-header {
font-weight:normal;
text-align:center;
}

.CodeMirror pre {
z-index:4;
}

.CodeMirror-linewidget {
background-color: hsl(240, 20%, 96%);
font-size:12px;
box-shadow:inset 10px 10px 10px -12px hsl(240, 20%, 17%);
margin-top:10px;
padding-top:5px;
padding-left:5px;
padding-bottom:2px;
}

.CodeMirror-linewidget ~ .CodeMirror-linewidget{
box-shadow:inset 10px 0px 10px -12px hsl(240, 20%, 17%);
margin-top:0px;
padding-top:0px;
}

.plato-line-widget {
}
117 changes: 117 additions & 0 deletions report/assets/css/plato-overview.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
.chart {
margin: 0 auto;
height: 200px;
}

.overview .chart {
height: 250px;
}

.historical .chart {
height:200px;
}

.chart rect {
cursor:pointer;
}

.file-list li {
border-bottom:1px solid #ccc;
padding-bottom:10px;
padding-top:10px;
}

.file-list li:nth-child(odd) {
background-color: hsl(0, 0%, 98%);
}

.fade-left {
background: -moz-linear-gradient(left, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* IE10+ */
background: linear-gradient(to right, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=1 ); /* IE6-9 */
}

.file-list li:nth-child(odd) .fade-left {
background: -moz-linear-gradient(left, rgba(249,249,249,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(249,249,249,1)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, rgba(249,249,249,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(249,249,249,1) 0%,rgba(255,255,255,0) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(249,249,249,1) 0%,rgba(255,255,255,0) 100%); /* IE10+ */
background: linear-gradient(to right, rgba(249,249,249,1) 0%,rgba(255,255,255,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f9f9f9', endColorstr='#00ffffff',GradientType=1 ); /* IE6-9 */
}

.fadeout {
position: absolute;
height: 50px;
z-index: 10;
float: left;
width:70px
}

.file {
white-space: nowrap;
}


.file-link {
text-align: right;
direction: rtl;
overflow: hidden;
height:40px;
font-size:20px;
color: #334B6D;
display:block;
padding:12px 12px 12px 0;
text-decoration: underline;
}

.file-link:hover {
color: #3B71B1;
}

.file-chart label {
width: 75px;
text-align: right;
margin-right: 10px;
}

.file-chart .chart-value {
margin-left: 3px;
font-size:11px;
}

.horizontal-bar {
display:inline-block;
height:8px;
border-radius: 0 4px 4px 0;
}

.threshold-0 .horizontal-bar {
background-color: #01939A;
}
.threshold-1 .horizontal-bar {
background-color: #FFAB00;
}
.threshold-2 .horizontal-bar {
background-color: #FF0700;
}


@media (max-width: 767px) {
.file-link {
text-align: center;
}
}

.complexity, .sloc, .bugs, .lint {
font-weight: normal;
}

.on { /* marking 'sorting buttons' active */
font-weight: bold;
}
Loading

0 comments on commit e5e8bc3

Please sign in to comment.