Skip to content

Commit

Permalink
resolve code-factor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SunPodder committed Jun 24, 2023
1 parent 0a04060 commit cc1f8df
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ body:
attributes:
value: |
This is a bug tracker of Flame-Route. Use search to check whether your issue has been already reported and perhaps solved.
To submit a bug report, fill the form below. Provide as much as possible information about the encountered issue. We may request extended information such as `strace` logs if considered necessary. This will help the maintainers to understand the problem correctly and provide a solution.
To submit a bug report, fill the form below. Provide as much as possible information about the encountered issue. We may request extended information such as `strace` logs if considered necessary. This will help the maintainers to understand the problem correctly and provide a solution.
Make sure that your logs do not leak sensitive information (passwords, API keys, etc). Be patient, do not expect that issue could get resolved immediately.
Expand Down Expand Up @@ -64,6 +64,6 @@ body:
label: Additional Information
description: Enter any additional information related to the bug
placeholder: Enter additional information here
validations:
validations:
required: false

4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: jwlawson/actions-setup-cmake@v1.13
with:
cmake-version: '3.26.0'

- name: Build
run: |
mkdir build
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Test
run: |
bash test/test.sh || exit 1
- name: Generate Artifact
run: |
cd build
Expand Down
10 changes: 7 additions & 3 deletions check.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#!/bin/bash

if ! [[ $(command -v include-what-you-use && command -v cppcheck) ]]; then
echo "Dependencies not found!\nExiting..."
printf "Dependencies not found!\nExiting...\n"
exit
fi

# list all changed .cpp and .hpp files
changed_files=$(git diff --name-only HEAD~1 | grep -E "\.(cpp|hpp)$")
if [[ -z "$*" ]]; then
changed_files=$(git diff --name-only HEAD~1 | grep -E "\.(cpp|hpp)$")
else
changed_files=($@)
fi

if [[ -z "$changed_files" ]]; then
if [[ -z "${changed_files[*]}" ]]; then
exit
else
echo "Changed files:"
Expand Down
4 changes: 2 additions & 2 deletions fmt.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash

# if arguments are given format them
if [[ ! -z "$1" ]]; then
files=$@
if [[ ! -z "$*" ]]; then
files=($@)
else
# get all changed files
files=$(git diff --name-only HEAD | grep -E '\.(cpp|hpp)$' | grep -v 'src/mime' | grep -v "json_impl" | grep -v "inja")
Expand Down
7 changes: 3 additions & 4 deletions src/logger/logger.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifndef LOGGER_HPP
#define LOGGER_HPP
#include "utils/utils.hpp"
#include <ctime>
#include <iostream>
#include <string>
Expand Down Expand Up @@ -47,8 +48,7 @@ class Logger {
* print the message with the given color
*/
static inline void __print(std::string msg, std::string color) {
std::time_t now = time(0);
std::string dt = ctime(&now);
std::string dt = Flame::Utils::getCTime();
dt.erase(dt.length() - 1);
std::cout << "[" << dt << "] " << color << msg << "\033[0m"
<< std::endl;
Expand All @@ -71,8 +71,7 @@ class Logger {

template <typename T, typename... Args>
static void Error(T t, Args... args) {
std::time_t now = time(0);
std::string dt = ctime(&now);
std::string dt = Flame::Utils::getCTime();
dt.erase(dt.length() - 1);

std::string msg = "";
Expand Down

0 comments on commit cc1f8df

Please sign in to comment.