gcontini
2020-10-31 9c33ad84278353286bbb4118cd11ca3fcfec439a
codacy cleanup
11个文件已修改
1个文件已删除
49 ■■■■■ 已修改文件
.github/workflows/cpp.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
doc/api/extend.rst 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
doc/index.rst 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
git_rebase.sh 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/inspector/inspector.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/base/base64.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/hw_identifier/hw_identifier_facade.cpp 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/hw_identifier/identification_strategy.cpp 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/os/linux/execution_environment.cpp 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/os/linux/os_linux.cpp 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/os/windows/network.cpp 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.github/workflows/cpp.yml
@@ -1,4 +1,4 @@
name: Github_Actions
name: Github_CI
on:
   push: 
jobs:
README.md
@@ -5,8 +5,8 @@
[![Standard](https://img.shields.io/badge/c%2B%2B-11-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization)
[![unstable](http://badges.github.io/stability-badges/dist/unstable.svg)](http://github.com/badges/stability-badges)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Build Status](https://travis-ci.org/open-license-manager/open-license-manager.svg?branch=develop)](https://travis-ci.org/open-license-manager/open-license-manager)
![Github_Actions](https://github.com/open-license-manager/open-license-manager/workflows/Github_Actions/badge.svg)
[![travis](https://travis-ci.org/open-license-manager/open-license-manager.svg?branch=develop)](https://travis-ci.org/open-license-manager/open-license-manager)
[![Github_CI](https://github.com/open-license-manager/open-license-manager/workflows/Github_CI/badge.svg)](https://github.com/open-license-manager/open-license-manager/actions)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/62d6e1bb22d648bd85b6f3bc344a545a)](https://www.codacy.com/manual/gcontini/open-license-manager?utm_source=github.com&utm_medium=referral&utm_content=open-license-manager/open-license-manager&utm_campaign=Badge_Grade)
[![codecov](https://codecov.io/gh/open-license-manager/open-license-manager/branch/develop/graph/badge.svg)](https://codecov.io/gh/open-license-manager/open-license-manager)
[![Github Issues](https://img.shields.io/github/issues/open-license-manager/open-license-manager)](http://github.com/open-license-manager/open-license-manager/issues)
doc/api/extend.rst
@@ -21,19 +21,18 @@
============================================
Included with the library there are three hardware identification strategies: `IP_ADDRESS`, `STRATEGY_ETHERNET` (mac address) and 
`STRATEGY_ETHERNET` (partition serial number). If you want to change the preferred one:
`STRATEGY_DISK` (partition serial number). If you want to change the preferred one:
  
  - locate the file `licensecc_properties.h`` (usually in ``projects/<$project_name>/include/licensecc/<$project_name>``
  - you can change the order of the strategies in the following code block (the strategies will be tried in sequence until the first one succeeds):
.. code-block:: c
.. code-block:: c
#define LCC_BARE_TO_METAL_STRATEGIES { STRATEGY_ETHERNET, STRATEGY_ETHERNET, STRATEGY_NONE }
#define LCC_VM_STRATEGIES { STRATEGY_ETHERNET, STRATEGY_NONE }
#define LCC_LXC_STRATEGIES { STRATEGY_ETHERNET, STRATEGY_NONE }
#define LCC_DOCKER_STRATEGIES { STRATEGY_NONE }
#define LCC_CLOUD_STRATEGIES { STRATEGY_NONE }
   
Custom license locator 
doc/index.rst
@@ -11,8 +11,10 @@
.. _unstable: http://github.com/badges/stability-badges
.. |License| image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg
.. _License: ttps://opensource.org/licenses/BSD-3-Clause
.. |BuildStatus| image:: https://travis-ci.org/open-license-manager/open-license-manager.svg?branch=develop
.. _BuildStatus: https://travis-ci.org/open-license-manager/open-license-manager
.. |TravisBuild| image:: https://travis-ci.org/open-license-manager/open-license-manager.svg?branch=develop
.. _TravisBuild: https://travis-ci.org/open-license-manager/open-license-manager
.. |GithubCI| image:: https://github.com/open-license-manager/open-license-manager/workflows/Github_CI/badge.svg
.. _GithubCI: https://github.com/open-license-manager/open-license-manager/actions
.. |CodacyBadge| image:: https://api.codacy.com/project/badge/Grade/62d6e1bb22d648bd85b6f3bc344a545a
.. _CodacyBadge: https://www.codacy.com/manual/gcontini/open-license-manager?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=open-license-manager/open-license-manager&amp;utm_campaign=Badge_Grade
.. |codecov| image:: https://codecov.io/gh/open-license-manager/open-license-manager/branch/develop/graph/badge.svg
git_rebase.sh
File was deleted
src/inspector/inspector.cpp
@@ -107,7 +107,7 @@
                 << static_cast<unsigned int>(osAdapter.ipv4_address[1]) << "-"
                 << static_cast<unsigned int>(osAdapter.ipv4_address[0]) << "]" << endl;
            cout << "   mac address [" << std::hex;
            for (int i = 0; i < 8; i++) {
            for (int i = 0; i < sizeof(osAdapter.mac_address); i++) {
                if (i != 0) {
                    cout << ":";
                }
src/library/base/base64.cpp
@@ -48,7 +48,7 @@
string base64(const void* binaryData, size_t len, int lineLenght) {
    const unsigned char* bin = (const unsigned char*)binaryData;
    int rc = 0;  // result counter
    // int rc = 0;  // result counter
    unsigned int byteNo;  // I need this after the loop
    int modulusLen = len % 3;
@@ -108,7 +108,7 @@
    tmp_str.erase(std::remove(tmp_str.begin(), tmp_str.end(), '\n'), tmp_str.end());
    const unsigned char* safeAsciiPtr = (const unsigned char*)tmp_str.c_str();
    std::vector<uint8_t> bin;
    int cb = 0;
    // int cb = 0;
    unsigned int charNo;
    int pad = 0;
    size_t len = tmp_str.size();
src/library/hw_identifier/hw_identifier_facade.cpp
@@ -53,6 +53,7 @@
    unique_ptr<IdentificationStrategy> strategy_ptr = IdentificationStrategy::get_strategy(strategy);
    HwIdentifier pc_id;
    FUNCTION_RETURN result = strategy_ptr->generate_pc_id(pc_id);
    pc_id.set_use_environment_var(use_env_var);
    if (result != FUNC_RET_OK) {
        throw logic_error("strategy " + to_string(strategy_ptr->identification_strategy()) + " failed");
    }
src/library/hw_identifier/identification_strategy.cpp
@@ -23,7 +23,6 @@
}
FUNCTION_RETURN IdentificationStrategy::generate_pc_id(HwIdentifier& pc_id) const {
    vector<array<uint8_t, HW_IDENTIFIER_PROPRIETARY_DATA>> data;
    const vector<HwIdentifier> available_ids = alternative_ids();
    FUNCTION_RETURN result = FUNC_RET_NOT_AVAIL;
    if (available_ids.size() > 0) {
src/library/os/linux/execution_environment.cpp
@@ -1,9 +1,10 @@
/*
 * virtualization.cpp
 * execution_environment.cpp
 *
 *  Created on: Dec 15, 2019
 *      Author: GC
 */
#define __STDC_WANT_LIB_EXT1__1
#include <paths.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -31,10 +32,10 @@
    char path[MAX_PATH] = {0};
    char proc_path[MAX_PATH], pidStr[64];
    pid_t pid = getpid();
    sprintf(pidStr, "%d", pid);
    strcpy(proc_path, "/proc/");
    strcat(proc_path, pidStr);
    strcat(proc_path, "/cgroup");
    snprintf(pidStr, sizeof(pidStr), "%d", pid);
    strncpy(proc_path, "/proc/", sizeof(proc_path));
    strncat(proc_path, pidStr, sizeof(proc_path));
    strncpy(proc_path, "/cgroup", sizeof(proc_path));
    FILE *fp;
    char *line = NULL;
@@ -48,9 +49,6 @@
    }
    while ((read = getline(&line, &len, fp)) != -1 && result == 0) {
        // line[len]=0;
        // printf("Retrieved line of length %zu:\n", read);
        // printf("%s", line);
        if (strstr(line, "docker") != NULL) {
            result = CONTAINER_TYPE::DOCKER;
        }
src/library/os/linux/os_linux.cpp
@@ -97,7 +97,7 @@
FUNCTION_RETURN parse_blkid(const std::string &blkid_file_content, std::vector<DiskInfo> &diskInfos_out,
                            std::unordered_map<std::string, int> &disk_by_uuid) {
    DiskInfo diskInfo;
    DiskInfo diskInfo = {};
    int diskNum = 0;
    for (std::size_t oldpos = 0, pos = 0; (pos = blkid_file_content.find("</device>", oldpos)) != std::string::npos;
         oldpos = pos + 1) {
@@ -111,6 +111,8 @@
        parseUUID(disk_sn.c_str(), diskInfo.disk_sn, sizeof(diskInfo.disk_sn));
        std::string disk_type = getAttribute(cur_dev, "TYPE");
        disk_by_uuid.insert(std::pair<std::string, int>(disk_sn, diskInfo.id));
        diskInfo.label_initialized = true;
        diskInfo.sn_initialized = true;
        // unlikely that somebody put the swap on a removable disk.
        // this is a first rough guess on what can be a preferred disk for blkid devices
        // just in case /etc/fstab can't be accessed or it is not up to date.
src/library/os/windows/network.cpp
@@ -127,7 +127,6 @@
    }
    IP_ADAPTER_INFO* pAdapter = pAdapterInfo;
    FUNCTION_RETURN result = FUNC_RET_OK;
    while (pAdapter) {
        if (pAdapter->Type == MIB_IF_TYPE_ETHERNET) {
            OsAdapterInfo ai = {};