Skip to content

Commit 0ea152e

Browse files
committed
changes made
Signed-off-by: Vinayakjeet Singh Karki <139736674+vinayakjeet@users.noreply.github.com>
1 parent 868788b commit 0ea152e

File tree

3 files changed

+31
-24
lines changed

3 files changed

+31
-24
lines changed

.github/workflows/codacy.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ jobs:
5353
# This will handover control about PR rejection to the GitHub side
5454
max-allowed-issues: 2147483647
5555

56-
- name: Filter out MISRA
56+
# Filter out MISRA and potentially reduce the number of runs in the SARIF output
57+
- name: Filter and Reduce SARIF
5758
run: |
5859
pip install globber
59-
python3 scripts/filter_sarif.py --input results.sarif --output filtered.sarif --split-lines -- "-**/*.*:cppcheck_misra*"
60+
python3 scripts/filter_and_reduce_sarif.py --input results.sarif --output filtered_and_reduced.sarif
61+
env:
62+
PYTHONUNBUFFERED: 1
6063

61-
# Upload the SARIF file generated in the previous step
64+
65+
# Upload the SARIF file generated in the previous step
6266
- name: Upload SARIF results file
6367
uses: github/codeql-action/upload-sarif@v3
6468
with:
65-
sarif_file: filtered.sarif
69+
sarif_file: filtered_and_reduced.sarif

avogadro/mainwindow.cpp

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,41 +1980,45 @@ void MainWindow::buildMenu()
19801980
m_fileToolBar->addAction(action);
19811981
connect(action, SIGNAL(triggered()), SLOT(saveFileAs()));
19821982
// Initialize autosave feature
1983-
m_autosaveInterval = 5; // Autosave interval in minutes
1984-
m_autosaveTimer = new QTimer(this);
1985-
connect(m_autosaveTimer, &QTimer::timeout, this, &MainWindow::autosaveDocument);
1986-
m_autosaveTimer->start(m_autosaveInterval * 60000); // Convert minutes to milliseconds
1987-
1988-
void MainWindow::autosaveDocument()
1989-
{
1983+
m_autosaveInterval = 5; // Autosave interval in minutes
1984+
m_autosaveTimer = new QTimer(this);
1985+
connect(m_autosaveTimer, &QTimer::timeout, this,
1986+
&MainWindow::autosaveDocument);
1987+
m_autosaveTimer->start(m_autosaveInterval *
1988+
60000); // Convert minutes to milliseconds
1989+
1990+
void MainWindow::autosaveDocument()
1991+
{
19901992
if (!m_molecule || !m_moleculeDirty) {
1991-
return; // No molecule loaded or no changes made since the last save.
1993+
return; // No molecule loaded or no changes made since the last save.
19921994
}
19931995

1994-
QString autosaveDirPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/autosave";
1996+
QString autosaveDirPath =
1997+
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) +
1998+
"/autosave";
19951999
QDir autosaveDir(autosaveDirPath);
19962000
if (!autosaveDir.exists()) {
1997-
autosaveDir.mkpath(".");
2001+
autosaveDir.mkpath(".");
19982002
}
19992003

20002004
// Construct autosave file name
20012005
QString autosaveFilename;
20022006
if (m_molecule->hasData("fileName")) {
2003-
QFileInfo fileInfo(m_molecule->data("fileName").toString().c_str());
2004-
autosaveFilename = fileInfo.baseName() + "_autosave.cjson";
2007+
QFileInfo fileInfo(m_molecule->data("fileName").toString().c_str());
2008+
autosaveFilename = fileInfo.baseName() + "_autosave.cjson";
20052009
} else {
2006-
autosaveFilename = "unsaved_autosave.cjson";
2010+
autosaveFilename = "unsaved_autosave.cjson";
20072011
}
20082012
QString autosaveFilePath = autosaveDirPath + "/" + autosaveFilename;
20092013

20102014
// Use CJSON format for autosaving
20112015
Io::CjsonFormat writer;
20122016
if (!writer.writeFile(autosaveFilePath, *m_molecule)) {
2013-
qWarning() << "Failed to autosave the document to" << autosaveFilePath;
2017+
qWarning() << "Failed to autosave the document to" << autosaveFilePath;
20142018
} else {
2015-
qDebug() << "Document autosaved to" << autosaveFilePath;
2019+
qDebug() << "Document autosaved to" << autosaveFilePath;
20162020
}
2017-
}
2021+
}
20182022

20192023
// Export action for menu
20202024
QStringList exportPath = path;

avogadro/mainwindow.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class MainWindow : public QMainWindow
6969

7070
public slots:
7171
void setMolecule(Avogadro::QtGui::Molecule* molecule);
72-
void autosaveDocument(); //line to declare the autosave slot
72+
void autosaveDocument(); // line to declare the autosave slot
7373
/**
7474
* Update internal state to reflect that the molecule has been modified.
7575
*/
@@ -391,16 +391,15 @@ private slots:
391391
void setProjectionPerspective();
392392

393393
private:
394-
395394
QtGui::Molecule* m_molecule;
396395
QtGui::RWMolecule* m_rwMolecule;
397396
QtGui::MoleculeModel* m_moleculeModel;
398397
QtGui::LayerModel* m_layerModel;
399398
QtGui::ScenePlugin* m_activeScenePlugin;
400399
bool m_queuedFilesStarted;
401400
QStringList m_queuedFiles;
402-
QTimer* m_autosaveTimer; // for the autosave timer
403-
int m_autosaveInterval; // for autosave interval in minutes
401+
QTimer* m_autosaveTimer; // for the autosave timer
402+
int m_autosaveInterval; // for autosave interval in minutes
404403
QStringList m_recentFiles;
405404
QList<QAction*> m_actionRecentFiles;
406405

0 commit comments

Comments
 (0)