style: Improve modules consistency (#3006)

* cmake - consistent parse version method names

* crystal - consistent parse version method names

* dart - consistent parse version method names

* deno - consistent parse version method names

* golang - consistent parse version method names

* helm - consistent parse version method names

* implement get_command_string_output, java - consistent parse version method names & small refactor

* julia - consistent parse version method names

* kotlin - consistent parse version method names and refactor

* lua - consistent parse version method names and refactor

* implement get_command_string_output for scala

* format crystal module

* remove outdated comment

* node use format_module_version

* terraform - consistent parse version method names

* vagrant - consistent parse version method names

* format

* refactor python module

* improve rlang module consistency

* fix clippy warning
This commit is contained in:
filip
2021-08-25 17:41:10 +02:00
committed by GitHub
parent 779def1362
commit 1c9758f08b
18 changed files with 160 additions and 213 deletions
+4 -3
View File
@@ -32,8 +32,9 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
})
.map(|variable| match variable {
"version" => {
let crystal_version =
get_crystal_version(&context.exec_cmd("crystal", &["--version"])?.stdout)?;
let crystal_version = parse_crystal_version(
&context.exec_cmd("crystal", &["--version"])?.stdout,
)?;
VersionFormatter::format_module_version(
module.get_name(),
&crystal_version,
@@ -57,7 +58,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
Some(module)
}
fn get_crystal_version(crystal_version: &str) -> Option<String> {
fn parse_crystal_version(crystal_version: &str) -> Option<String> {
Some(
crystal_version
// split into ["Crystal", "0.35.1", ...]