Comments (8)
I'll need the two versions of these files to reproduce the problem. Can you post them?
from cloc.
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.
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.
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.
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.
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.
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.
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)
- Cloc counts line where comment starts as comment in XML HOT 1
- Nickel config lang support
- exe version of cloc not support file name with chinese character HOT 4
- Language support for Luau .luau HOT 1
- List winget in README package maganers HOT 1
- Cloc has problems with */* in Go HOT 3
- Cloc doesn't count correctly Visual Basic code HOT 1
- Add Modelica language HOT 3
- support Processing Language
- Documentation for --force-lang is slightly wrong HOT 3
- --fullpath does not work with --vcs=git HOT 4
- Possible inconsistent counting of "same" lines HOT 5
- Add option to exclude shebang from the count HOT 5
- Add support for .gjs/.gts
- dotnet tool HOT 1
- Reading JSON file kills cloc when counting repo HOT 3
- --csv-delimiter doesn't work HOT 4
- --not-match-d= includes file at root of pattern HOT 7
- Attempt to create a file in the present working directory. HOT 2
- Support for the Yang language
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloc.