Skip to content

Commit

Permalink
Merge pull request #3 from fede2cr/main
Browse files Browse the repository at this point in the history
Adding rust linter
  • Loading branch information
msLinuxNinja authored Dec 7, 2023
2 parents 3e39d81 + 7d9ebe4 commit 85803ad
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Lint Code Base

on:
push:
pull_request:
branches: [master, main]

jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest

permissions:
contents: read
packages: read
statuses: write

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper
# list of changed files within `super-linter`
fetch-depth: 0

- name: Lint Code Base
uses: super-linter/super-linter@v5
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# chronox
=======
A simple Rust utility to convert log files from local time to UTC 🦀.

[![GitHub Super-Linter](https://github.com/msLinuxNinja/chronox/actions/workflows/linter.yml/badge.svg)](https://github.com/marketplace/actions/super-linter)

It takes dates in `Month Day HH:MM:SS` format and converts it to `YYYY-MM-DD HH:MM:SS Z` format.

Expand Down Expand Up @@ -40,4 +42,4 @@ chmod +x chronox
# Gotchas

* The utility assumes the year is current year.
* Only files that use `Month Day HH:MM:SS` format would work (Like `messages` or `syslog`).
* Only files that use `Month Day HH:MM:SS` format would work (Like `messages` or `syslog`).
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use chrono::{DateTime, FixedOffset, Utc, Datelike};
use chrono::{DateTime, Datelike, FixedOffset, Utc};
use colored::Colorize;
use rayon::prelude::*;
use regex::Regex;
use std::env;
use std::fs;
use std::process;


fn get_time_utc(date_str: String) -> DateTime<Utc> {
let date: Result<DateTime<FixedOffset>, chrono::ParseError> =
DateTime::parse_from_str(&date_str, "%Y-%b-%d %H:%M:%S %z"); // Date format: 2023-Jan-01 01:00:00 +0000
Expand Down

0 comments on commit 85803ad

Please sign in to comment.