Skip to content

Commit

Permalink
feat: linter from working directory
Browse files Browse the repository at this point in the history
  • Loading branch information
qarlosalberto committed Jul 29, 2023
1 parent 40108cd commit 34fe012
Show file tree
Hide file tree
Showing 6 changed files with 776 additions and 812 deletions.
1,538 changes: 765 additions & 773 deletions packages/colibri/src/config/config_declaration.ts

Large diffs are not rendered by default.

15 changes: 0 additions & 15 deletions packages/colibri/src/config/config_web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,6 @@ export const WEB_CONFIG = `
<div class="mb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="general-general-logging">
<label class="form-check-label" for="general-general-logging">
Enable show TerosHDL console with each message.
</label>
</div>
</div>
<div class="mb-3">
<label for="general-general-pypath" class="form-label">Python3 binary path (e.g.: /usr/bin/python3). Empty if you want to use the system path. <strong>Install teroshdl. E.g: pip3 install teroshdl</strong></label>
<input class="form-control" id="general-general-pypath" rows="3" value=""></input>
Expand Down Expand Up @@ -4019,8 +4007,6 @@ export const WEB_CONFIG = `
let element_value;
config["general"] = {}
config["general"]["general"] = {}
element_value = document.getElementById("general-general-logging").checked;
config["general"]["general"]["logging"] = element_value
element_value = document.getElementById("general-general-pypath").value;
config["general"]["general"]["pypath"] = element_value
element_value = document.getElementById("general-general-makepath").value;
Expand Down Expand Up @@ -4538,7 +4524,6 @@ export const WEB_CONFIG = `
}
function set_config(config){
document.getElementById("general-general-logging").checked = config["general"]["general"]["logging"];
document.getElementById("general-general-pypath").value = config["general"]["general"]["pypath"];
document.getElementById("general-general-makepath").value = config["general"]["general"]["makepath"];
document.getElementById("general-general-go_to_definition_vhdl").checked = config["general"]["general"]["go_to_definition_vhdl"];
Expand Down
5 changes: 0 additions & 5 deletions packages/colibri/src/config/helpers/configs/general.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
logging:
description: "Enable show TerosHDL console with each message."
type: boolean
value: true

pypath:
description: "Python3 binary path (e.g.: /usr/bin/python3). Empty if you want to use the system path. <strong>Install teroshdl. E.g: pip3 install teroshdl</strong>"
type: string
Expand Down
15 changes: 0 additions & 15 deletions packages/colibri/src/config/web_config.html
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,6 @@ <h6 class="card-subtitle mb-2 text-muted"></h6>



<div class="mb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="general-general-logging">
<label class="form-check-label" for="general-general-logging">
Enable show TerosHDL console with each message.
</label>
</div>
</div>




<div class="mb-3">
<label for="general-general-pypath" class="form-label">Python3 binary path (e.g.: /usr/bin/python3). Empty if you want to use the system path. <strong>Install teroshdl. E.g: pip3 install teroshdl</strong></label>
<input class="form-control" id="general-general-pypath" rows="3" value=""></input>
Expand Down Expand Up @@ -3999,8 +3987,6 @@ <h4 class="card-subtitle text-muted">Simulation</h4>
let element_value;
config["general"] = {}
config["general"]["general"] = {}
element_value = document.getElementById("general-general-logging").checked;
config["general"]["general"]["logging"] = element_value
element_value = document.getElementById("general-general-pypath").value;
config["general"]["general"]["pypath"] = element_value
element_value = document.getElementById("general-general-makepath").value;
Expand Down Expand Up @@ -4518,7 +4504,6 @@ <h4 class="card-subtitle text-muted">Simulation</h4>
}

function set_config(config){
document.getElementById("general-general-logging").checked = config["general"]["general"]["logging"];
document.getElementById("general-general-pypath").value = config["general"]["general"]["pypath"];
document.getElementById("general-general-makepath").value = config["general"]["general"]["makepath"];
document.getElementById("general-general-go_to_definition_vhdl").checked = config["general"]["general"]["go_to_definition_vhdl"];
Expand Down
14 changes: 10 additions & 4 deletions packages/colibri/src/linter/base_linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@

import { create_temp_file } from "../process/utils";
import { Process } from "../process/process";
import { p_options } from "../process/common";
import * as common from "./common";
import { check_if_path_exist, normalize_path } from "../utils/file_utils";
import * as path_lib from "path";
import * as logger from "../logger/logger";
import { t_file } from "../project_manager/common";
import { file_utils } from "../utils/export_t";

export abstract class Base_linter {
abstract binary: string;
Expand Down Expand Up @@ -71,14 +73,18 @@ export abstract class Base_linter {

async exec_linter(file: string, options: common.l_options) {
this.delete_previus_lint();
const command = this.get_command(file, options);

const command = this.get_command(file, options);

const msg = `Linting with command: ${command} `;
// eslint-disable-next-line no-console
logger.Logger.log(msg, logger.T_SEVERITY.INFO);

const P = new Process();
const result = await P.exec_wait(command);
const file_dir = file_utils.get_directory(file);
const opt: p_options = {
cwd: file_dir,
};
const result = await P.exec_wait(command, opt);

this.delete_previus_lint();
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ <h4 id="release-notes"> Minor changes v5.0.5 and v5.0.7</h4>
<p>
<ul>
<li> Auto detection of compilation order in simulations ⭐</li>
<li> Linter is executed from file directory, so it's possible to use relative include directories ⭐</li>
<li> Improve Python detection</li>
<li> Improve linter/formatter path detection</li>
<li> Fix bug VHDL component template</li>
Expand Down

0 comments on commit 34fe012

Please sign in to comment.