Giter Club home page Giter Club logo

Comments (8)

AlDanial avatar AlDanial commented on June 21, 2024

I'll need the two versions of these files to reproduce the problem. Can you post them?

from cloc.

houwen0 avatar houwen0 commented on June 21, 2024

The above screenshot is the commit provided by Gitlab, and I can provide you with these two source files:

1、SsoController

package com.test.svc.web.controller;

import com.test.svc.common.constant.ServiceExceptionCode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.test.framework.auditlog.expection.ServiceException;
import top.test.framework.auth.client.UnifyAuthContextHolder;
import top.test.framework.auth.client.annotation.Authorize;
import top.test.framework.auth.facade.authrization.AuthContext;
import top.test.framework.auth.facade.constant.AuthConstant;
import top.test.framework.auth.facade.entity.UserInfo;
import top.test.framework.biz.ro.TestResult;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/sso")
public class SsoController {

@GetMapping("/authorize")
@Authorize()
public TestResult<String> authorize(HttpServletRequest request) {
    AuthContext authContext = (AuthContext) request.getServletContext().getAttribute(AuthConstant.AUTH_CONTEXT_KEY);
    return TestResult.success(ServiceExceptionCode.SUCCESS.code,"process success",authContext.getUserInfo().getUsername());
}

@GetMapping("/unauthorize")
public TestResult<String> unAuthorize( ) {
    return TestResult.success(ServiceExceptionCode.SUCCESS.code,"process success","No verification is required !");
}

@GetMapping("/authorize/userInfo")
@Authorize()
public TestResult<UserInfo> authorizeUserInfo(HttpServletRequest request) {
    UserInfo userInfo  = UnifyAuthContextHolder.getUserInfo();

// AuthContext authContext = (AuthContext) request.getServletContext().getAttribute(AuthConstant.AUTH_CONTEXT_KEY);
return TestResult.success(ServiceExceptionCode.SUCCESS.code,"process success",userInfo);
}

}

2、SysInfoController

package com.test.svc.web.controller.svc_govern;

import com.test.svc.common.constant.ServiceExceptionCode;
import com.test.svc.core.service.impl.svc_govern.SysInfoServiceImpl;
import org.springframework.web.bind.annotation.*;
import top.test.framework.auth.client.annotation.Authorize;
import top.test.framework.biz.ro.TestResult;
import javax.annotation.Resource;
import com.test.svc.dal.po.svc_govern.mbg.SysInfo;
import top.test.framework.biz.ro.PagedTestResult;

/**
*
*/
@RestController
@RequestMapping("/sysInfo")
public class SysInfoController {

@Resource
private SysInfoServiceImpl sysInfoService;



/**
* 新增
*/
@PostMapping("")
@Authorize(roles = {},authorities ={})
public TestResult insert(@RequestBody SysInfo sysInfo){
    sysInfoService.insert(sysInfo);
    return TestResult.success(ServiceExceptionCode.SUCCESS.code,null,null);
}


/**
* 更新
*/
@PutMapping("")
@Authorize(roles = {},authorities ={})
public TestResult<String> update(@RequestBody SysInfo sysInfo){
    sysInfoService.update(sysInfo);
    return TestResult.success( ServiceExceptionCode.SUCCESS.code,null,null);
}

/**
* Load查询
*/
@GetMapping("/{id}")
@Authorize(roles = {},authorities ={})
public TestResult<SysInfo> load(@PathVariable long id){
    return TestResult.success(ServiceExceptionCode.SUCCESS.code,null, sysInfoService.load(id));
}

@GetMapping("/pageShow/pageNum/{pageNum}/pageSize/{pageSize}")
@Authorize(roles = {},authorities ={})
public PagedTestResult<SysInfo> page(@PathVariable int pageNum, @PathVariable int pageSize){
    return  sysInfoService.showPage(pageNum,pageSize);
}

}

from cloc.

houwen0 avatar houwen0 commented on June 21, 2024

I am not sure if the “git diff” is a usage issue or if the function is incomplete. If there are any usage issues, please tell me the correct method

from cloc.

AlDanial avatar AlDanial commented on June 21, 2024

I don't think the content you posted is consistent with the results you showed. I have attached the files as you provided them. These two files have little in common. When I run cloc --diff SsoController.java SysInfoController.java I get

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Java
 same                            0              0              0              8
 modified                        1              0              1             19
 added                           0              4             11             10
 removed                         0              0              0              6
-------------------------------------------------------------------------------
SUM:
 same                            0              0              0              8
 modified                        1              0              1             19
 added                           0              4             11             10
 removed                         0              0              0              6
-------------------------------------------------------------------------------

If you attach the files rather than cut/paste their contents it will be easier to work with them.
SysInfoController.java.txt
SsoController.java.txt

from cloc.

houwen0 avatar houwen0 commented on June 21, 2024

sorry,What I am comparing is not these two files, but the two commit attempts of Gitlab。The command I executed is as follows:
cloc-1.98 --git-diff-rel 39a54ce3 66ec3dfe

"39a54ce3" or "66ec3dfe" is gitlab's commit id

from cloc.

AlDanial avatar AlDanial commented on June 21, 2024

Based on your screenshot, your commits refer to two files each. When you tell cloc to diff the two commits you are really saying "compare the files between these two commits". To reproduce this problem I'll either need to clone your git repo or to get the four files themselves.

from cloc.

houwen0 avatar houwen0 commented on June 21, 2024

Sorry, the real files are confidential. I'm wondering if you support the "git diff" feature. I want to use this feature to count the changes made in a git commit, such as additions, modifications, and deletions.

from cloc.

AlDanial avatar AlDanial commented on June 21, 2024

cloc uses internal logic to compute diffs between two commits (the output from git diff by itself is not sufficient to compute comment and code changes), so yes, it does support the capability you want.

However, without the input files, I won't be able to tell why the results are not as you expect. If you encounter this problem with files you are able to distribute, please open a new issue.

from cloc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.