Skip to content

Commit

Permalink
Improve Codacy score
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Bijaoui committed Oct 1, 2018
1 parent 8980a7f commit 107bbcd
Show file tree
Hide file tree
Showing 35 changed files with 116 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.DS_Store
node_modules/
dist/*-report.html
test/unit/coverage
tests/unit/coverage

# local env files
.env.local
Expand Down
31 changes: 1 addition & 30 deletions dev/mixins/utils.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,7 @@
export default {
computed: {
prettyModel() {
return this.prettyJSON(this.model);
}
},
methods: {
prettyJSON(json) {
if (json) {
json = JSON.stringify(json, null, 4);
json = json
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
return json.replace(
/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)/g,
function(match) {
let cls = "number";
if (/^"/.test(match)) {
if (/:$/.test(match)) {
cls = "key";
} else {
cls = "string";
}
} else if (/true|false/.test(match)) {
cls = "boolean";
} else if (/null/.test(match)) {
cls = "null";
}
return "<span class='" + cls + "'>" + match + "</span>";
}
);
}
return JSON.stringify(this.model, null, 4);
}
}
};
2 changes: 1 addition & 1 deletion dev/projects/basic/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</div>
<div class="row">
<div class="col-sm-12">
<pre v-if="model" v-html="prettyModel"></pre>
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions dev/projects/basic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<%= htmlWebpackPlugin.options.title %>
</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script>
Expand Down
6 changes: 5 additions & 1 deletion dev/projects/basic/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Vue from "vue";
import VueFormGenerator from "../../../src";

import VueFormGenerator from "@";
Vue.use(VueFormGenerator);

import VueHighlightJS from "vue-highlightjs";
Vue.use(VueHighlightJS);

import App from "./app.vue";

new Vue({
Expand Down
2 changes: 1 addition & 1 deletion dev/projects/checklist/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</div>
<div class="row">
<div class="col-sm-12">
<pre v-if="model" v-html="prettyModel"></pre>
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions dev/projects/checklist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<%= htmlWebpackPlugin.options.title %>
</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
</head>

<body>
Expand Down
6 changes: 5 additions & 1 deletion dev/projects/checklist/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Vue from "vue";
import VueFormGenerator from "./../../../src";

import VueFormGenerator from "@";
Vue.use(VueFormGenerator);

import VueHighlightJS from "vue-highlightjs";
Vue.use(VueHighlightJS);

import App from "./app.vue";

new Vue({
Expand Down
2 changes: 1 addition & 1 deletion dev/projects/custom/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</div>
<div class="row">
<div class="col-sm-12">
<pre v-if="model" v-html="prettyModel"></pre>
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions dev/projects/custom/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU"
crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
</head>

<body>
Expand Down
6 changes: 5 additions & 1 deletion dev/projects/custom/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Vue from "vue";
import VueFormGenerator from "../../../src";

import VueFormGenerator from "@";
Vue.use(VueFormGenerator);

import VueHighlightJS from "vue-highlightjs";
Vue.use(VueHighlightJS);

import App from "./app.vue";

new Vue({
Expand Down
2 changes: 1 addition & 1 deletion dev/projects/full/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</vue-form-generator>
</div>
<div class="col-md-6">
<pre v-if="model" v-html="prettyModel"></pre>
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions dev/projects/full/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.11.2/css/bootstrap-select.min.css">
Expand Down
6 changes: 5 additions & 1 deletion dev/projects/full/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Vue from "vue";
import VueFormGenerator from "../../../src";

import VueFormGenerator from "@";
Vue.use(VueFormGenerator);

import VueHighlightJS from "vue-highlightjs";
Vue.use(VueHighlightJS);

import App from "./app.vue";

new Vue({
Expand Down
2 changes: 1 addition & 1 deletion dev/projects/grouping/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</div>
<div class="row">
<div class="col-sm-12">
<pre v-if="model" v-html="prettyModel"></pre>
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions dev/projects/grouping/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<%= htmlWebpackPlugin.options.title %>
</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
</head>

<body>
Expand Down
6 changes: 5 additions & 1 deletion dev/projects/grouping/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Vue from "vue";
import VueFormGenerator from "../../../src";

import VueFormGenerator from "@";
Vue.use(VueFormGenerator);

import VueHighlightJS from "vue-highlightjs";
Vue.use(VueHighlightJS);

import App from "./app.vue";

new Vue({
Expand Down
2 changes: 1 addition & 1 deletion dev/projects/multi/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>
<div class="row">
<div class="col-sm-12">
<pre v-if="model" v-html="prettyModel"></pre>
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions dev/projects/multi/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<%= htmlWebpackPlugin.options.title %>
</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script>
Expand Down
6 changes: 5 additions & 1 deletion dev/projects/multi/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Vue from "vue";
import VueFormGenerator from "../../../src";

import VueFormGenerator from "@";
Vue.use(VueFormGenerator);

import VueHighlightJS from "vue-highlightjs";
Vue.use(VueHighlightJS);

import App from "./app.vue";

new Vue({
Expand Down
2 changes: 1 addition & 1 deletion dev/projects/multiselect/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</div>
<div class="row">
<div class="col-sm-12">
<pre v-if="model" v-html="prettyModel"></pre>
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions dev/projects/multiselect/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<%= htmlWebpackPlugin.options.title %>
</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
<link rel="stylesheet" type="text/css" href="https://unpkg.com/vue-multiselect@2.0.8/dist/vue-multiselect.min.css">
<script type="text/javascript" src="https://unpkg.com/vue-multiselect@2.0.8/dist/vue-multiselect.min.js"></script>
</head>
Expand Down
6 changes: 5 additions & 1 deletion dev/projects/multiselect/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Vue from "vue";
import VueFormGenerator from "../../../src";

import VueFormGenerator from "@";
Vue.use(VueFormGenerator);

import VueHighlightJS from "vue-highlightjs";
Vue.use(VueHighlightJS);

import App from "./app.vue";

new Vue({
Expand Down
2 changes: 1 addition & 1 deletion dev/projects/picker/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</div>
<div class="row">
<div class="col-sm-12">
<pre v-if="model" v-html="prettyModel"></pre>
<pre v-highlightjs="prettyModel"><code class="json"></code></pre>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions dev/projects/picker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<%= htmlWebpackPlugin.options.title %>
</title>

<link rel="stylesheet" type="text/css" href="https://rawgit.com/highlightjs/highlight.js/master/src/styles/github.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/css/bootstrap-datetimepicker.css">
Expand Down
6 changes: 5 additions & 1 deletion dev/projects/picker/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Vue from "vue";
import VueFormGenerator from "../../../src";

import VueFormGenerator from "@";
Vue.use(VueFormGenerator);

import VueHighlightJS from "vue-highlightjs";
Vue.use(VueHighlightJS);

import App from "./app.vue";

new Vue({
Expand Down
22 changes: 1 addition & 21 deletions dev/style.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import url("https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300|Open+Sans:300,600,700&subset=latin-ext");
@import url("https://fonts.googleapis.com/css?family=Open+Sans:300,600,700&subset=latin-ext");
html {
font-family: "Open Sans";
font-size: 14px;
Expand All @@ -10,26 +10,6 @@ html {
box-sizing: border-box;
}

pre {
overflow: auto;

.string {
color: #885800;
}
.number {
color: blue;
}
.boolean {
color: magenta;
}
.null {
color: red;
}
.key {
color: green;
}
}

.control-buttons {
button {
margin: 0.2em 0.3em;
Expand Down
Loading

0 comments on commit 107bbcd

Please sign in to comment.